NoriginMedia / react-spatial-navigation

DEPRECATED. HOC-based Spatial Navigation. NEW Hooks version is available here: https://github.com/NoriginMedia/norigin-spatial-navigation
MIT License
226 stars 64 forks source link

Fix scroll animations issue #66

Closed salvan13 closed 4 years ago

salvan13 commented 4 years ago

it fixes wrong layouts if the browser supports smooth scrolling and the application is using it (scroll-behavior: smooth).

in the prev version we were updating the layouts after the focus was set, but if an element is scrolling the position was not updated (because of the animated scroll), with this change it updates the layouts when the smartNavigate function is called, so the layouts are updated at the moment they are used to calculate next focus key

asgvard commented 4 years ago

Great! 👏 It is also a good optimisation, since when you call "setFocus" manually, you don't really need updated coordinates.