Skip to content
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

fix(ui): prevent button in modal from being clicked twice when pressing enter key #10820

Merged

Conversation

situ2001
Copy link
Collaborator

@situ2001 situ2001 commented Jan 7, 2024

close #10635

Through my investigation, I found that pressing the Enter key while focusing on a button triggers the click event twice, with the second click happening within the mixins/on-key-down function of the modal.

(mixins/on-key-down
state
{;; enter
13 (fn [state _e]
(some->
(.querySelector (rum/dom-node state) "button.ui__modal-enter")
(.click)))})))

The idea to fix issues is to stop the propagation of keydown event in ui/button when it is assigned ui__modal-enter classname.

image

@github-actions github-actions bot added the fix label Jan 7, 2024
@situ2001
Copy link
Collaborator Author

situ2001 commented Jan 7, 2024

Updated: A better way is to prevent default behavior of pressing Enter key(in the case, behavior is click the focused button) when event is bubbled to modal.

image

Copy link
Collaborator

@andelf andelf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Nice catch.

@tiensonqin tiensonqin merged commit 2055a08 into logseq:master Jan 9, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Graph md files are re-indexed twice after first re-index
3 participants