-
Notifications
You must be signed in to change notification settings - Fork 50.2k
[react-events] Keyboard responder propagation handling #16657
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
|
ReactDOM: size: 0.0%, gzip: -0.0% Details of bundled changes.Comparing: 539640d...4290034 react-dom
|
| try { | ||
| isInsideEventHandler = true; | ||
| const type = typeof value === 'object' && value !== null ? value.type : ''; | ||
| invokeGuardedCallbackAndCatchFirstError(type, fn, undefined, value); |
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.
Is there a follow-up to fix this? It seems important that event handler doesn't crash the rest of the code?
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.
Yeah, I plan on addressing it this week.
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.
This was already fixed in a follow-up right? This guard is still there on master
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.
LOL. I did, I’m clearly losing the plot.
This adds support for conditional Keyboard responder propagation, for where there are nested keyboard responders. To allow a
onKeyDownoronKeyUpevent to propagate the callback is required to returntrueto propagate a single responder level. This is done by providing a new method on context calledcontinuePropagation– which tells the responder propagation system to propagate a single level after processing the current responder (of the same responder type).I also had to remove the usage of
invokeGuardedCallbackAndCatchFirstErrorwhen calling the user-land event callback. This was because the existinginvokeGuardedCallbackAndCatchFirstErrordoesn't support returning a value from the callback – which is what we need here. Attempting to change the mechanics of the function seemed far too invasive, so we can test this approach out internally to see if we run into any issues (we shouldn't though).