hasOffscreenRect method in SpatialNavigation.cpp currently does not works fine for focusable elements in overflowed content. it needs a refactoring for that.
Created attachment 55130 [details] patch v1 no requestion review as patch depends on patch on bug 36463
This patch needs a re-baseline.
IMO hasOffscreenRect should also take into account scrolling and the direction in which we are scrolling. i.e. if we scroll the frame, due to not finding any element, and then an element becomes visible, that element should be focused, even though it was not visible before we scrolled.
hasOffscreenRect() is using absoluteClippedOverflowRect() to get the node's rect. If the node is hidden inside a parent that is scrollable div, absoluteClippedOverflowRect() will return (0,0) for the size of the rect, so I think this function is already doing the right thing.
it has been fixed by Yael