React Hooks based Spatial Navigation (Key & Remote Control Navigation) / Web Browsers, Smart TVs and Connected TVs
useFocusable
- focusBoundaryDirections
, array of directions to block when isFocusBoundary
is enableduseFocusable
- forceFocus
to mark the component to be the target for auto-restore focus logic when focus is lostdoesFocusableExist
to check if the focusable component exists before setting focus on it. Safety featuresetFocus, getCurrentFocusKey, navigateByDirection, pause, resume, updateAllLayouts
are now exported from SpatialNavigation
instead of useFocusable
hook.FocusContext
in React DevtoolslastFocusedChildKey
for newly added parent componentsparentsHavingFocusedChild
array after removalautoRestoreFocus
logic to trigger not only on Lead components, but also on Parents that had focused child when being removed. Edge case, normally children are removed first.hasFocusedChild
when new child is created and focused right awaylastFocusedChild
was updated only on blur, but not on manual focus, resulting in a wrong key being storeduseFocusedContext
file to useFocusContext
to match the export namefocused
state to false
on unmount. This is to support "double-mount" in Strict mode in React 18.useEffectOnce
hook that introduced issues with unmounted components being remained as focusable.This release includes support for Accessibility. With the new configuration flag shouldFocusDOMNode
it is possible to also set a native browser focus on the DOM node when the item is focused by the library. This allows usage of aria
tags for screen readers.
New init
config option useGetBoundingClientRect
that affects the measurements of sizes and coordinates.
Added
Changed