[csswg-drafts] Starting point can be off-screen (#3365)

frivoal has just created a new issue for https://github.com/w3c/csswg-drafts:

== Starting point can be off-screen ==
---

Migrated from https://github.com/WICG/spatial-navigation/issues/129
Originally created by @hugoholgersson on *Fri, 02 Nov 2018 07:26:42 GMT*

---
Even when the focused element F is off the screen, for example after `F.focus({preventScroll: true})`, spatnav uses F as starting point for distance calculations.

Why is this a problem? It gives an unpredictable user experience: 

Imagine F being off-screen, above the visual viewport. If the user goes `up`, she probably wants to search the viewport for candidates from the bottom-most edge. (This is how spatnav would search a focused scroller.) Instead, the current spec calculates distances from the scrolled out F. The closest candidate is the focusable closest to F's position - a position the user can't see.

In Chrome we've solved this by skipping off-screen starting points: when F is off-screen, we search from an edge of the first visible enclosing container of F. I've updated https://bit.ly/snav2, my vision for spatnav in Chrome, to cover this case.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3365 using your GitHub account

Received on Monday, 3 December 2018 07:42:05 UTC