From dce7ef74b2d8b2f2ca8f2841f68c27388a547232 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 22 Sep 2022 15:44:56 +0700 Subject: [PATCH] fix(web): fixes for non-focus-related unit-test breaks --- web/source/dom/domEventHandlers.ts | 8 ++++++-- web/testing/attachment-api/index.html | 2 -- web/tools/recorder/browserDriver.ts | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/web/source/dom/domEventHandlers.ts b/web/source/dom/domEventHandlers.ts index 3ff134fe55..b68eb1c22d 100644 --- a/web/source/dom/domEventHandlers.ts +++ b/web/source/dom/domEventHandlers.ts @@ -405,7 +405,7 @@ namespace com.keyman.dom { doChangeEvent(_target: HTMLElement) { if(DOMEventHandlers.states.changed) { let event = new Event('change', {"bubbles": true, "cancelable": false}); - + // Ensure that touch-aliased elements fire as if from the aliased element. if(_target['base'] && _target['base']['kmw_ip']) { _target = _target['base']; @@ -679,6 +679,10 @@ namespace com.keyman.dom { elem = e.relatedTarget as HTMLElement; } + if(elem['body']) { + elem = elem['body']; // Occurs in Firefox for design-mode iframes. + } + this.executeBlur(elem); }.bind(this); @@ -772,7 +776,7 @@ namespace com.keyman.dom { const x = touch.screenX; const y = touch.screenY; - + // Allow content of input elements to be dragged horizontally or vertically if(typeof this.firstTouch == 'undefined' || this.firstTouch == null) { this.firstTouch={x:x,y:y}; diff --git a/web/testing/attachment-api/index.html b/web/testing/attachment-api/index.html index 37cb68476c..ebec016955 100644 --- a/web/testing/attachment-api/index.html +++ b/web/testing/attachment-api/index.html @@ -87,8 +87,6 @@

Inputs:

Textareas:

IFrames:

-

Note: The iframe section should not actually attach/enable for touch devices - and does not support setKeyboardForControl.

Design-mode IFrames:

Note: The iframe section should not actually attach/enable for touch devices diff --git a/web/tools/recorder/browserDriver.ts b/web/tools/recorder/browserDriver.ts index cb03ef1836..55402f5afb 100644 --- a/web/tools/recorder/browserDriver.ts +++ b/web/tools/recorder/browserDriver.ts @@ -52,7 +52,7 @@ namespace KMWRecorder { // To be safe, we replicate the MouseEvent similarly to the keystroke event. var downEvent; var upEvent; - if(target['base'] && target instanceof HTMLDivElement) { + if((window['keyman'] as any).util.device.touchable) { downEvent = new Event(BrowserDriver.oskDownTouchType); upEvent = new Event(BrowserDriver.oskUpTouchType); downEvent['touches'] = [{"target": oskKeyElement}];