Sometimes when navigating in a direction the focus jumps on an element in another direction.
It's not happening often, in our case only on Tizen when we keep pressed down/up keys in the homepage.
Makes sense. The main reason for it to be async is to unblock main thread and recalculate layouts within animation frames intervals. But if it causing issues like this, let’s remove it.
Sometimes when navigating in a direction the focus jumps on an element in another direction. It's not happening often, in our case only on Tizen when we keep pressed down/up keys in the homepage.
We investigated the problem and we found wrong
layout.top
positions, causing wrong siblings detection in a direction ( the arraysiblings
here https://github.com/NoriginMedia/react-spatial-navigation/blob/master/src/spatialNavigation.js#L540 contains wrong elements )The root cause is the
setTimeout
inmeasureLayout
function https://github.com/NoriginMedia/react-spatial-navigation/blame/master/src/measureLayout.js#L28 It seems some of the callbacks are executed before the actual sibling detection while some other are executed after.We removed it to update the layouts synchronously and the problem disappeared.
If there isn't any reason to keep it I suggest to remove it.