@noriginmedia/norigin-spatial-navigation
Advanced tools
Changelog
[2.2.2]
SpatialNavigation
core service with typesChangelog
[2.2.1]
distanceCalculationMethod
that allows switching between edge-based, center-based and corner-based (default) distance calculations.customDistanceCalculationFunction
option, enabling custom logic for determining distances between focusable components. This will override the getSecondaryAxisDistance
method.updateRTL
method to update the RTL behavior dynamically. This method allows toggling the Right-to-Left layout at runtime, updating the spatial navigation behavior without requiring reinitialization.Changelog
[2.1.1]
init
config option domNodeFocusOptions
for passing FocusOptions when using shouldFocusDOMNode
Changelog
[2.1.0]
init
config option shouldUseNativeEvents
that enables the use of native events for triggering actions, such as clicks or key presses.init
config option rtl
that changes focus behavior for layouts in right-to-left (RTL) languages such as Arabic and Hebrew.Changelog
[2.0.2]
ref
to useFocusable
ArrowRight
.Changelog
[2.0.0]
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 componentsChangelog
[1.3.3]
parentsHavingFocusedChild
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.Changelog
[1.3.2]
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 nameChangelog
[1.3.1]
focused
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.