From 5e099a65afe9695592e2b355806d8cddcae3a9ed Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Wed, 10 Jan 2024 13:28:45 +0700 Subject: [PATCH] fix(web): Add null check of offsetParent for longpress keys --- web/src/engine/osk/src/input/gestures/browser/subkeyPopup.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/engine/osk/src/input/gestures/browser/subkeyPopup.ts b/web/src/engine/osk/src/input/gestures/browser/subkeyPopup.ts index e29521bb423..20cfdb341f1 100644 --- a/web/src/engine/osk/src/input/gestures/browser/subkeyPopup.ts +++ b/web/src/engine/osk/src/input/gestures/browser/subkeyPopup.ts @@ -288,7 +288,8 @@ export default class SubkeyPopup implements GestureHandler { const _Box = vkbd.topContainer; let rowElement = (e.key as OSKBaseKey).row.element; let ss=subKeys.style; - var x = e.offsetLeft + (e.offsetParent).offsetLeft + 0.5*(e.offsetWidth-subKeys.offsetWidth); + let parentOffsetLeft = e.offsetParent ? (e.offsetParent).offsetLeft : 0; + var x = e.offsetLeft + parentOffsetLeft + 0.5*(e.offsetWidth-subKeys.offsetWidth); var xMax = vkbd.width - subKeys.offsetWidth; if(x > xMax) {