fix(web): touch-based unit test issues

This commit is contained in:
jahorton 2021-09-20 15:46:59 +07:00
parent 48fe02023c
commit da8e83090a
2 changed files with 5 additions and 3 deletions

View file

@ -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.
//

View file

@ -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;