-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Ensure handled key event is not propagated to IME #46829
[web] Ensure handled key event is not propagated to IME #46829
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 or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
9f87c1b to
b24fedd
Compare
|
The change looks ok, but it doesn't seem to me that the unit test this PR modifies is related to the change. Is this change tested? |
6811026 to
60bbdc3
Compare
The test was missing indeed. Added now, can you take another look? |
| return eventKeyCode; | ||
| } | ||
| if (result == null) { | ||
| if ((eventCode ?? '').isEmpty && (eventKey ?? '').isEmpty) { |
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.
nit: could this be eventCode == null && eventKey == null ?
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.
No. We're passing empty strings there during some tests unfortunately.
Renzo-Olivares
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.
LGTM with a small nit. Thanks for the change!
|
@dkwingsmt, friendly ping |
|
Is anything related to |
It is. The |
60bbdc3 to
129cce8
Compare
) Reverts #46829 Fixes flutter/flutter#136857 Speculative fix for The builds breaking on the web text tests as seen here: https://github.com/flutter/flutter/runs/17840697842
…136872) flutter/engine@8d51b64...d0d7b4d 2023-10-19 [email protected] Revert "[web] Ensure handled key event is not propagated to IME" (flutter/engine#47086) 2023-10-19 [email protected] Roll Fuchsia Linux SDK from 2HSBpWikGWvPJlHOP... to Z2mOZ5cuPJWvKn22P... (flutter/engine#47094) 2023-10-19 [email protected] Roll Skia from 64c5de6663a4 to 62acc1e162cc (1 revision) (flutter/engine#47093) 2023-10-19 [email protected] Roll Dart SDK from eb3fb9a13e16 to 1b425a25a6dd (1 revision) (flutter/engine#47092) 2023-10-19 [email protected] Roll Skia from 85971b25cf4b to 64c5de6663a4 (2 revisions) (flutter/engine#47091) 2023-10-19 [email protected] Roll Fuchsia Mac SDK from PxJM5ivbnbYoVkqBg... to 0hLSNJ_DCTzRvTVJe... (flutter/engine#47090) 2023-10-19 [email protected] Roll Dart SDK from d9b1e60fe442 to eb3fb9a13e16 (1 revision) (flutter/engine#47084) 2023-10-18 [email protected] Update buildroot to ab76ccba2ca4ce4. (flutter/engine#47078) 2023-10-18 [email protected] migrate const_finder to use the implementation from package:kernel (flutter/engine#47077) 2023-10-18 [email protected] Roll Skia from d561b276b5d9 to 85971b25cf4b (1 revision) (flutter/engine#47076) 2023-10-18 [email protected] [Impeller] Guard execution of ReactorGLES operations with a mutex (flutter/engine#47068) 2023-10-18 [email protected] [Impeller] Document ReactorGLES. (flutter/engine#47070) 2023-10-18 [email protected] [web] Ensure handled key event is not propagated to IME (flutter/engine#46829) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from 2HSBpWikGWvP to Z2mOZ5cuPJWv fuchsia/sdk/core/mac-amd64 from PxJM5ivbnbYo to 0hLSNJ_DCTzR If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Fixes [136460](flutter/flutter#136460) Changes: - Raw keyboard event is handled during capture phase. This is to ensure that the framework processes the event before reaching to IME text area and raw keyboard can stop the propagation for handled events. - `RawKeyboard` event handler is invoked from `KeyboardBinding` event handler. This is to prevent race condition because both handlers now run in capture phase and `KeyboardBinding` needs to process the event first. *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I signed the [CLA]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
) Reverts #46829 Fixes flutter/flutter#136857 Speculative fix for The builds breaking on the web text tests as seen here: https://github.com/flutter/flutter/runs/17840697842
#136874) flutter/engine#46829 changed event handling sequence on web so that KeyboardBinding/RawKeyboard handles the text event first before it reaches IME. That means when dispatching synthetised events to IME every keydown event must have a corresponding keyup, otherwise consistency assertions in `KeyboardBindings` are triggered. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [Features we expect every widget to implement]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
This PR relands #46829, which got reverted in #47086 because of flutter/flutter#136857. There are no changes in the PR compared to the reverted one. The issue are missing `keyup` events in the integration test, which triggers assertion in `KeyboardBindings` and which should be fixed by flutter/flutter#136874. Changes: - Raw keyboard event is handled during capture phase. This is to ensure that the framework processes the event before reaching to IME text area and raw keyboard can stop the propagation for handled events. - `RawKeyboard` event handler is invoked from `KeyboardBinding` event handler. This is to prevent race condition because both handlers now run in capture phase and `KeyboardBinding` needs to process the event first. ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I signed the [CLA]. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
Fixes 136460
Changes:
RawKeyboardevent handler is invoked fromKeyboardBindingevent handler. This is to prevent race condition because both handlers now run in capture phase andKeyboardBindingneeds to process the event first.If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.