Releases: NoriginMedia/react-spatial-navigation
Updated behaviour for `onBecameFocused` and added `onBecameBlurred` callback
v2.10.0 Added Enrico Bardelli to contributors
KeyDetails
v2.9.3 2.9.3 (#56)
Fixed issue #46 Focus jumps on wrong component
Bugfix layout positions (#47) * removed setTimeout in measureLayout to avoid coordinates mismatches * lint * update changelog * 2.9.2
Added method for imperative directional navigation
Before the directional navigation was only done when listening to key events, now it is possible to call navigateByDirection
to perform this manually.
Avoid not needed property update
Fix issue #7
Bugfixing for ref to component in native mode
Bugfixing for ref to component in native mode
Added safety checks for component existence on Enter or Arrow press
Added safety checks for component existence on Enter or Arrow press
Added copy of "node" ref to "layout" object
Added a copy of "node" ref to "layout" to also have it onBecameFocused callback. Useful for lazy measuring of the layout by the node ref, e.g. in native environment where we don't measure all layouts on focusable component creation.
Allowed components to be focused with "setFocus" even if they have "focusable=false"
Latest feature with focusable
prop had a check inside setFocus
function that blocked component from being imperatively focused. This caused certain regressions, for example when you "setFocus()" on the whole page on mount. The previous logic allowed to save target focus key even if component doesn't exist yet, and then when it gets mounted, the focus was set to this component. So this check was removed to allow setting focus manually on any focusKey (even non existent ones) with setFocus
.
Assuming you have full control of where you call setFocus
, you can avoid setting it to components that should have focusable={false}
, which you also have control of.
focusable
prop now only affects "automatic" navigation logic such as directional navigation, focusing lastFocusedChild or preferredFocusChild.
Added "focusable" prop. Moved react and react-dom deps to peers.
Added
focusable
prop that enables component as a focusable target. Default is true. Usable when you need to temporarily disable focusable behaviour on the component. E.g. disabled button state.
Changed
- Moved
react
andreact-dom
to peer dependencies