-
Notifications
You must be signed in to change notification settings - Fork 87
fix: check if keydown event is prevent before closing #10360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Overlay allows the `vaadin-overlay-escape-press` custom to be default prevented before closing. This change also allows the `defaultPrevent` called on the `keydown` event to stop the overlay from closing. That should allow cases where, while interacting with an interactive element inside a Grid cell, hitting <kbd>Esc</kbd> to move the focus back to the cell, the overlay parent won't be closed, since Grid calls `preventDefault` on the `keydown` event. Fixes vaadin/flow-components#8176
|
With the latest change, some tests in web-components/packages/date-picker/src/vaadin-date-picker-mixin.js Lines 1083 to 1086 in 1a10749
... for all keys, except Tab. I wasn't able to fully understand the reason from reading the comment, and I wonder if it's safe to whitelist Escape as well. |
Sincerely, I don't know what this call is actually doing. Removing it doesn't affect the tests in |
|
I would suggest to also add an integration test e.g. |
Done. |
web-padawan
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. Improved the test to use sendKeys() which we usually do for integration tests.
|
…) (#10364) Co-authored-by: Diego Cardoso <diego@vaadin.com>
…) (#10365) Co-authored-by: Diego Cardoso <diego@vaadin.com>



Description
Overlay allows the
vaadin-overlay-escape-presscustom to be default prevented before closing. This change also allows thedefaultPreventcalled on thekeydownevent to stop the overlay from closing.That should allow cases where, while interacting with an interactive element inside a Grid cell, hitting Esc to move the focus back to the cell, the overlay parent won't be closed, since Grid calls
preventDefaulton thekeydownevent.To manually test it, add this snippet to the
/dev/dialog.htmlpage:Fixes vaadin/flow-components#8176
Type of change