diff --git a/web/source/osk/browser/keytip.ts b/web/source/osk/browser/keytip.ts index 47ba68acff..19c62edfe1 100644 --- a/web/source/osk/browser/keytip.ts +++ b/web/source/osk/browser/keytip.ts @@ -31,7 +31,9 @@ namespace com.keyman.osk.browser { let util = keyman.util; // Create and display the preview - if(on) { + // If !key.offsetParent, the OSK is probably hidden. Either way, it's a half- + // decent null-guard check. + if(on && key.offsetParent) { // The key element is positioned relative to its key-square, which is, // in turn, relative to its row. Rows take 100% width, so this is sufficient. // diff --git a/web/source/osk/inputEventCoordinate.ts b/web/source/osk/inputEventCoordinate.ts index 178733e8c0..62de3edde5 100644 --- a/web/source/osk/inputEventCoordinate.ts +++ b/web/source/osk/inputEventCoordinate.ts @@ -50,8 +50,8 @@ namespace com.keyman.osk { } public get activeInputCount(): number { - if(window['TouchEvent'] && this.source instanceof TouchEvent) { - return this.source.touches.length; + if(window['TouchEvent'] && this.source['touches'] !== undefined && this.source['touches'] !== null) { + return this.source['touches'].length; } else { const event = this.source as MouseEvent; return event.buttons > 0 ? 1 : 0;