Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Keyboard events priority, propagation or bubbling#1068

Discussion options

I have a global hook in my portal app that listen to 'ctrl+esc' keys. In a child component, from a shared component library, I have a form with another hook on the 'esc' key alone. I would like to know if it is possible to trap the 'ctrl+esc' key in my child component too, so both events would fire? So far, I couldn't make it work, I only have 1 of the 2 events that gets fired. Basically I would like to trap the keyboard event from the 'esc' in my component (which check if the form is dirty before closing) and then, the one from the 'ctrl+esc' in my main app.

You must be logged in to vote

@cotepatrice This is because the event bubbling does not work similar to React synthetic events - If your 1st event have a complex logic, then the event bubbling stops there. Try wrapping the complex logic in to settimeout, it will trigger in all use cases

Replies: 1 comment

Comment options

@cotepatrice This is because the event bubbling does not work similar to React synthetic events - If your 1st event have a complex logic, then the event bubbling stops there. Try wrapping the complex logic in to settimeout, it will trigger in all use cases

You must be logged in to vote
0 replies
Answer selected bycotepatrice
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@cotepatrice@svelpari-nagarro

[8]ページ先頭

©2009-2025 Movatter.jp