dillon1000/react

Commit

[DOM] Handle scrolling of empty Fragments below containers (#37061)

e.g. `render(<Fragment ref={...}>{children}</Fragment>)` where
`children` contain no Host Components.

For `Document` we just noop because some part of the document is always
in view.
For `ShadowRoot` we use its `host`.
Any other `DocumentFragment` without a `host` issues a warning because
there's nothing to scroll. This matches the existing warning when you
call `scrollIntoView(false)` on an empty Fragment without siblings.

Notably this also applies to `<html><body /></html>` in `children`
because we skip `HostSingleton` at the moment.

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Browse files
Changed paths2 files
First-parent comparison
M packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js ModifiedM packages/react-dom/src/__tests__/ReactDOMFragmentRefs-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…