dillon1000/react

Commit

Allow fragment refs to attempt focus/focusLast on nested host children (#33058)

This enables `focus` and `focusLast` methods on FragmentInstances to
search nested host components, depth first. Attempts focus on each child
and bails if one is successful. Previously, only the first level of host
children would attempt focus.

Now if we have an example like

```
component MenuItem() {
  return (<div><a>{...}</a></div>)
}

component Menu() {
  return <Fragment>{items.map(i => <MenuItem i={i} />)}</Fragment>
}
```
We can target focus on the first or last a tag, rather than checking
each wrapping div and then noop.
Browse files
Changed paths5 files
First-parent comparison
M fixtures/dom/src/components/fixtures/fragment-refs/FocusCase.js ModifiedM fixtures/dom/src/style.css ModifiedM packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js ModifiedM packages/react-dom/src/__tests__/ReactDOMFragmentRefs-test.js ModifiedM packages/react-reconciler/src/ReactFiberTreeReflection.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…