dillon1000/react
Commit
Browse files fix[devtools/useModalDismissSignal]: use getRootNode for shadow root case support (#28145)
In our custom implementation for handling modals dismiss signal, we use element's `ownerDocument` field, which expectedly doesn't work well with shadow root. Now using [`getRootNode`](https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode) instead of `ownerDocument` to support shadow root case. Without this, if RDT Frontend is hosted inside the shadow root, the modal gets closed after any click, including on the buttons hosted by modal: https://github.com/facebook/react/blob/00d42ac3542179c55f936f395ede7abaeb5900a3/packages/react-devtools-shared/src/devtools/views/hooks.js#L228-L238 Test plan: - Modals work as expected for Chrome DevTools integration - Modals work as expected at every other surfaces: browser extension, electron wrapper for RN, inline version for web
Changed paths1 file
First-parent comparisonpackages/react-devtools-shared/src/devtools/views/hooks.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…