Keyboard events priority, propagation or bubbling #1068
-
|
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. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
@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 |
Beta Was this translation helpful? Give feedback.
@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