Releases: NoriginMedia/Norigin-Spatial-Navigation
Releases · NoriginMedia/Norigin-Spatial-Navigation
Release list
Moved global methods, new features for focus restore and boundary directions
Added
- New property for
useFocusable-focusBoundaryDirections, array of directions to block whenisFocusBoundaryis enabled - New property
useFocusable-forceFocusto mark the component to be the target for auto-restore focus logic when focus is lost - New global method
doesFocusableExistto check if the focusable component exists before setting focus on it. Safety feature
Changed
- [BREAKING] Top level exports
setFocus, getCurrentFocusKey, navigateByDirection, pause, resume, updateAllLayoutsare now exported fromSpatialNavigationinstead ofuseFocusablehook.
Fixed
- Context display name is now called
FocusContextin React Devtools - Updating
lastFocusedChildKeyfor newly added parent components
Bugfixes, auto restore focus improvements
- Fixed the issue where component would have kept itself in the array of
parentsHavingFocusedChildarray after removal - Further improvements to
autoRestoreFocuslogic 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.
Bugfixes
Fixed
- Fixed a bug where parents were not updating their
hasFocusedChildwhen new child is created and focused right away - Fixed a bug where
lastFocusedChildwas updated only on blur, but not on manual focus, resulting in a wrong key being stored
Changed
- Renamed
useFocusedContextfile touseFocusContextto match the export name
Handling `StrictMode` without custom hook, more debug logs
Added
- Extra debug logs, printing focusable components data in addition to DOM nodes.
- Extra call to set
focusedstate tofalseon unmount. This is to support "double-mount" in Strict mode in React 18.
Changed
- [Potentially Breaking] Auto restore focus when the item is removed is now happening with a slight debounced delay. This is done to prevent multiple automatic focus restorations when multiple elements are remove one by one. Now it will accumulate all the auto-restore focus calls into one delayed debounced call with the final target parent to get focused.
Removed
- Custom
useEffectOncehook that introduced issues with unmounted components being remained as focusable.
Accessibility support: `.focus()` DOM node when the item is focused
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 "useGetBoundingClientRect" config option
New init config option useGetBoundingClientRect that affects the measurements of sizes and coordinates.
Added setThrottle
Added
- Add setThrottle to dynamically change throttle time. In relation to issue #45
Changed
- Remove event listeners for unbindEventHandlers regardless of throttle value
Fix focus lost
Changed
- Update
parentFocusKeywhenremoveFocusable - Fix issue with
destroy(addedbind)
es5 compliant (removed Reflect)
Replaced Reflect.deleteProperty with delete, to be es5 compliant.
Accept `focusDetails` argument in focusSelf
Added focusDetails argument in focusSelf (and also in setFocus).
Also, I modified the focusDetails interface to include either an event, nativeEvent or any key-value combination required. This object will be received at the onFocus callback.