-
Notifications
You must be signed in to change notification settings - Fork 47.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[react-interactions] Modify Scope query mechanism (#17095)
- Loading branch information
Showing
20 changed files
with
263 additions
and
213 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
37 changes: 0 additions & 37 deletions
37
packages/react-interactions/accessibility/docs/TabbableScope.md
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
packages/react-interactions/accessibility/docs/TabbableScopeQuery.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# TabbableScopeQuery | ||
|
||
`TabbableScopeQuery` is a custom scope implementation that can be used with | ||
`FocusContain`, `FocusGroup`, `FocusTable` and `FocusManager` modules. | ||
|
||
## Usage | ||
|
||
```jsx | ||
import tabbableScopeQuery from 'react-interactions/accessibility/tabbable-scope-query'; | ||
|
||
function FocusableNodeCollector(props) { | ||
const scopeRef = useRef(null); | ||
|
||
useEffect(() => { | ||
const scope = scopeRef.current; | ||
|
||
if (scope) { | ||
const tabFocusableNodes = scope.queryAllNodes(tabbableScopeQuery); | ||
if (tabFocusableNodes && props.onFocusableNodes) { | ||
props.onFocusableNodes(tabFocusableNodes); | ||
} | ||
} | ||
}); | ||
|
||
return ( | ||
<TabbableScope ref={scopeRef}> | ||
{props.children} | ||
</TabbableScope> | ||
); | ||
} | ||
``` |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.