Repository navigation
Conversation
toggle and beforetoggle are non-delegated events, so React only receives them through the per-element listenToNonDelegatedEvent call. react#32479 added those calls for dialog to setInitialProperties but not to hydrateProperties, so a hydrated dialog never fires onToggle or onBeforeToggle while a client-rendered one does. details and the popover attribute register the same events in both paths. Fixes react#37261
dianatofficial
left a comment
There was a problem hiding this comment.
Good refactor. Readability is much improved.
|
The build for this commit did not complete, so there is no size report. See the workflow run for details. Generated by sizebot against 85853c3 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #37261.
toggleandbeforetoggleare innonDelegatedEvents, so React only receives them through the per-elementlistenToNonDelegatedEventcall. #32479 added those calls fordialogtosetInitialPropertiesbut not tohydrateProperties, so a hydrated<dialog>never firesonToggleoronBeforeTogglewhile a client-rendered one does.onCancelandonClosework in both modes, anddetailsand thepopoverattribute register the same events in both paths.This adds the two missing registrations to the hydration path.
How did you test this change?
<dialog>with all four handlers and dispatches the four events. It fails onmain(onBeforeToggleandonTogglereceive 0 calls) and passes with this change.yarn test ReactDOMEventListener ReactDOMEventPropagation(115 tests) — pass.yarn test ReactDOMEventListener --prod(24 tests) — pass.yarn test ReactDOMServerIntegration(1602 tests) — pass.yarn test ReactDOMFizzServer(223 tests) — pass.yarn prettier,yarn linc,yarn flow dom-node— clean.