(opts: FocusManagerOptions = {})
| 220 | function createFocusManagerForScope(scopeRef: React.RefObject<Element[] | null>): FocusManager { |
| 221 | return { |
| 222 | focusNext(opts: FocusManagerOptions = {}) { |
| 223 | let scope = scopeRef.current!; |
| 224 | let {from, tabbable, wrap, accept} = opts; |
| 225 | let node = from || getActiveElement(getOwnerDocument(scope[0] ?? undefined))!; |
| 226 | let sentinel = scope[0].previousElementSibling!; |
| 227 | let scopeRoot = getScopeRoot(scope); |
| 228 | let walker = getFocusableTreeWalker(scopeRoot, {tabbable, accept}, scope); |
| 229 | walker.currentNode = isElementInScope(node, scope) ? node : sentinel; |
| 230 | let nextNode = walker.nextNode() as FocusableElement; |
| 231 | if (!nextNode && wrap) { |
| 232 | walker.currentNode = sentinel; |
| 233 | nextNode = walker.nextNode() as FocusableElement; |
| 234 | } |
| 235 | if (nextNode) { |
| 236 | focusElement(nextNode, true); |
| 237 | } |
| 238 | return nextNode; |
| 239 | }, |
| 240 | focusPrevious(opts: FocusManagerOptions = {}) { |
| 241 | let scope = scopeRef.current!; |
| 242 | let {from, tabbable, wrap, accept} = opts; |
nothing calls this directly
no test coverage detected