-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Add guard around FocusWithin responder root events #18080
Conversation
@@ -36,7 +36,7 @@ type FocusState = { | |||
isFocused: boolean, | |||
isFocusVisible: boolean, | |||
pointerType: PointerType, | |||
... | |||
addedRootEvents?: boolean, |
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.
Does it need to be optional?
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.
Let's make it just boolean.
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.
We don't use it in the Focus responder, only the FocusWithin responder. I didn't want to add more code to the state of that responder, so I opted to keep it optional for now. Breaking all the call-sites down by alternative state would make this a far more complex PR.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
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.
okay
We've run into an interesting problem internally that is likely due to a strange set of events from the recent
onBeforeBlur
change, causingaddRootEventTypes
to try and add the same event before removing it. This change should guard the change to prevent the invariant from occuring in these cases.I'll try and make a repro test tomorrow and see if there's an alternative way to fix this.