react-spectrum
14b74f32 - fix: guard null restore target in FocusScope restoreFocus (#10371)

Commit
6 days ago
fix: guard null restore target in FocusScope restoreFocus (#10371) getFirstInScope() returns the result of TreeWalker.nextNode(), which is null when the scope contains no focusable element, for example when its focusable content has been removed or hidden. The restoreFocus fallback passed that value straight into restoreFocusToElement(), throwing a TypeError on a null dereference. Correct the misleading return type and skip scopes with nothing to restore to, continuing up the focus scope tree instead. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
Parents
Loading