fix(web): Don't throw errors after detach#10086
Conversation
User Test ResultsTest specification and instructions
Test Artifacts
|
c8b1b90 to
2023360
Compare
|
These changes look like they address the symptom and are good failsafes to include, but not sure if they are addressing the root cause -- we shouldn't be receiving events on the elements at all once we detach. |
jahorton
left a comment
There was a problem hiding this comment.
IMO, this only masks #10031 - it does not actually fix it. I'd prefer something that actually fixes the root of the problem (in addition to warning about there being a problem if it arises at the point of the current would-be fix).
| const target = eventOutputTarget(e); | ||
| var Levent = preprocessKeyboardEvent(e, this.processor, this.hardDevice); | ||
| if(Levent == null) { | ||
| if(Levent == null || target == null) { |
There was a problem hiding this comment.
If target == null here, that in itself is an error we should probably log in some manner. The keystroke handler should only activate for elements that are currently in an attached & enabled state.
The attachment engine is supposed to ensure that the handler is only set for such elements, removing an element's event listeners when not attached. I feel like this change only masks the actual error.
There was a problem hiding this comment.
So should I remove the target == null check again so that we see the error on the console? Or how should we log?
In other words, you are agreeing with my comment 😁 |
|
Thought I'd look for a pointer for you. This codeblock should be highly-relevant: keyman/web/src/app/browser/src/hardwareEventKeyboard.ts Lines 254 to 283 in d084538 For "some reason," the |
Test Results
..Text Area 1 ..text area after clicking the Attach button |
|
Changes in this pull request will be available for download in Keyman version 17.0.221-alpha |
Fixes #10031.
User Testing
Preparations
TEST_FIXED: follow the repro instructions in #10031 to test if this is fixed. You can use the "KeymanWeb Sample Page - Tests the new Attachment/Enablement API functionality" (in manual mode) instead of the code listed in #10031.