Adds prevent modifier to keydown enter event handler on KDropdownMenu#1256
Open
AlexVelezLl wants to merge 1 commit into
Open
Adds prevent modifier to keydown enter event handler on KDropdownMenu#1256AlexVelezLl wants to merge 1 commit into
AlexVelezLl wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
.preventmodifier to the@keydown.enterevent handler onUiMenu. This is needed because when a dropdown menu item opens a new screen/modal that grabs the focus into a button, the button's@clickevent is also triggered.The reason the focus on the button triggers automatically on focus is that when it is focused, the key press is still active, and given that browsers interpret
buttonelements' enter keydown as click, it triggers its@clickevent. This doesn't happen, though, when we change the focus from one button to another, because this click interpretation only happens once in a given time lapse, and if it has already interpreted a click on a button, it ignores the keydown event when the second button is focused, but the problem is that these menu items arelielements.Also tried to change
@keydownto@keyupbut this led to a conflict with the key press event on the button that opens the dropdown, because this button reacts to the keydown event of the enter key press, opens the menu, and on key up, the handler of the first menu option was triggered for the same key press.Issue addressed
Will solve a bug found on learningequality/studio#5668.
Changelog
Steps to test
I have tested this using this playground: