-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Fix CapsLock keyevent #21584
[web] Fix CapsLock keyevent #21584
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Question: which framework integration test covers this case? |
Should be added to Tab e2e test after engine PR is in. |
nturgut
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed earlier, the e2e test can also go in with this PR.
LGTM.
Added test case to e2etests/web/regular_integration_tests/test_driver/text_editing_integration.dart |
nturgut
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the integration test :)
* Fix metaState for Key events for lock modifiers
Description
The web engine, to prevent the crash and keep Tab key working no matter what the lock state is, sets metastate for locks during keydown until handling at framework level is clarified.
metaState as part of RawKeyEvent is currently not making a clear distinction between modifiers and lock states. For example the code requires that NumLock state be true when user presses NumLock key (it will crash otherwise). The lock state on the other hand, won't be set in a browser until keyup on some platforms (see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).
Past issues,PRs related to this:
#45250
#46718
#14165
So if engine interprets metaState as persistent lock state such as NumLock, shortcuts break since the matcher will fail since there is no entry for NumLock+Tab or CapsLock+NumLock+Tab for example. Ideally? shortcuts should only consider lock states if it is explicitly provided to add specificity. The ambiguity of NumLock+key needs to be resolved to either mean Option1: a key is pressed when in NumLock state or Option2: key is pressed in combination with NumLock key at the same time. It should still allow a developer to distinguish between them by tracking keydown/keyup events.
Related Issues
flutter/flutter#66601
Tests
Added test case to e2etests/web/regular_integration_tests/test_driver/text_editing_integration.dart
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.Breaking Change
Did any tests fail when you ran them? Please read [handling breaking changes].