You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
closed:duplicateEquivalent to another issue, or a subset of another issuetopic:spectype:bugDescribes a problem with the spec/tests/polyfill in their present form
Conceptually I see spatnav as a key-hook that runs in the browser just before arrow-key scrolling. If spatnav didn't find anything to focus, it lets the standard arrow-key scrolling do its job.
navnotarget could be used to signal: "spatnav's search failed, here's your chance to do something before we hand over control to the arrow-keys".
When handling navnotarget, authors would still be able to find out, by looking at the focused element's container's overflow, if a scroll is about to happen or not.
onnavigate event seems the better approach than only supports of navbeforefocus and navnotarget. We can discuss with the issue in #32 as a single thread. How about this?
In addition, both behaviors (scrolling and none) would have to be classified for authors. I prefer to support the three types in a same level.
In addition, both behaviors (scrolling and none) would have to be classified for authors.
Is it really necessary to tell authors when spatnav is about to do arrow-key-scrolling? I think authors could get this kind of information by looking at the page layout (standard JS) from an onnavigate-handler.
If we don't explicitly have to tell authors when spatnav is about to do arrow-key-scrolling, then the onnavigate-event could be simplified... I'd like the navigate-event to be as simple as possible because I'm thinking, in the future, that event could also be sent before sequential (= tab-key) navigation. The simpler it is, the higher chance I will become implemented across browsers.
onnavigate-handler and three types of nav* handlers couldn't exist at the same time. It's a matter of choice. I'd like to briefly explain a use case using navbeforescroll event (or navigate event with a type of scroll).
There is a container element that has several child elements with sparsely a bit long vertical scroll. When a user pushes a down arrow key and it's about to trigger scrolling due to no visible elements in that direction, the author wants not to scroll but to move the focus to one of invisible elements far away from a scrollport.
In this situation, the author can use the navbeforescroll event so that the scrolling could be canceled by preventDefault() and the focus could be directly moved to the invisible element that the author wants with an implicit scrollIntoView. How about this use case? Apart from this, I could imagine several use cases using navbeforescroll. It seems to be separated from navnotarget. We can surely use the navigate event with a type of scroll to support this use case, but I hope to fix the choice for the smooth discussion. The choice could be easily reversed later.
BTW, As you mentioned, navbeforescroll can't be used in the sequential navigation. It would be a great point against the 'nav*' handlers approach. However, in terms of the spatial navigation, navbeforescroll should be supported for reasons mentioned above in some form.
That's a good use case. Thanks! But isn't vanilla JS + a slim onnavigate capable of doing this?
In this use case, a slim navigate-event would be sent with relatedTarget = null because no element will be focused by spatnav (spatnav will only trigger an arrow-key scroll). When an author sees the null, she could check the navigate-event's target's enclosing scroller. If it can scroll, that means spatnav will soon scroll it. With this information, she can decide to move focus manually with the same method: preventDefault() + betterElement.focus().
Right, theoretically. The additional procedures for checking relatedTarget and a current scroll offset seem inconvenient, though I'm not in favor of vanilla JS.
Right, but its hard to predict the popularity and usefulness of navbeforescroll. And since it can be pollyfilled via navigate, let's not include it in the spec's first round?
As you mentioned, navbeforescroll can't be used in the sequential navigation.
Yes. I believe we, at this point, only should add events and APIs that benefit and work with both spatial and sequential navigation... I believe that will make this API more popular and attractive.
closed:duplicateEquivalent to another issue, or a subset of another issuetopic:spectype:bugDescribes a problem with the spec/tests/polyfill in their present form
Activity
anawhj commentedon Mar 19, 2018
onnavigateevent seems the better approach than only supports ofnavbeforefocusandnavnotarget. We can discuss with the issue in #32 as a single thread. How about this?In addition, both behaviors (scrolling and none) would have to be classified for authors. I prefer to support the three types in a same level.
[-]Remove `navbeforescroll` and send `navnotarget` in its place?[/-][+]Remove `navbeforescroll`?[/+]hugoholgersson commentedon Mar 19, 2018
Is it really necessary to tell authors when spatnav is about to do arrow-key-scrolling? I think authors could get this kind of information by looking at the page layout (standard JS) from an
onnavigate-handler.If we don't explicitly have to tell authors when spatnav is about to do arrow-key-scrolling, then the
onnavigate-event could be simplified... I'd like thenavigate-event to be as simple as possible because I'm thinking, in the future, that event could also be sent before sequential (= tab-key) navigation. The simpler it is, the higher chance I will become implemented across browsers.anawhj commentedon Mar 19, 2018
onnavigate-handler and three types ofnav*handlers couldn't exist at the same time. It's a matter of choice. I'd like to briefly explain a use case usingnavbeforescrollevent (ornavigateevent with a type of scroll).There is a container element that has several child elements with sparsely a bit long vertical scroll. When a user pushes a down arrow key and it's about to trigger scrolling due to no visible elements in that direction, the author wants not to scroll but to move the focus to one of invisible elements far away from a scrollport.
In this situation, the author can use the
navbeforescrollevent so that the scrolling could be canceled by preventDefault() and the focus could be directly moved to the invisible element that the author wants with an implicit scrollIntoView. How about this use case? Apart from this, I could imagine several use cases usingnavbeforescroll. It seems to be separated fromnavnotarget. We can surely use thenavigateevent with a type of scroll to support this use case, but I hope to fix the choice for the smooth discussion. The choice could be easily reversed later.BTW, As you mentioned,
navbeforescrollcan't be used in the sequential navigation. It would be a great point against the 'nav*' handlers approach. However, in terms of the spatial navigation,navbeforescrollshould be supported for reasons mentioned above in some form.hugoholgersson commentedon Mar 19, 2018
That's a good use case. Thanks! But isn't vanilla JS + a slim
onnavigatecapable of doing this?In this use case, a slim
navigate-event would be sent withrelatedTarget = nullbecause no element will be focused by spatnav (spatnav will only trigger an arrow-key scroll). When an author sees thenull, she could check the navigate-event's target's enclosing scroller. If it can scroll, that means spatnav will soon scroll it. With this information, she can decide to move focus manually with the same method: preventDefault() + betterElement.focus().anawhj commentedon Mar 19, 2018
Right, theoretically. The additional procedures for checking
relatedTargetand a current scroll offset seem inconvenient, though I'm not in favor of vanilla JS.hugoholgersson commentedon Mar 21, 2018
Right, but its hard to predict the popularity and usefulness of
navbeforescroll. And since it can be pollyfilled vianavigate, let's not include it in the spec's first round?Yes. I believe we, at this point, only should add events and APIs that benefit and work with both spatial and sequential navigation... I believe that will make this API more popular and attractive.
frivoal commentedon Apr 2, 2018
Based on the discussion above, and using example 5, example 6, and example 7, and in agreement with @jihyerish, I am closing #32 and #36 as no change.
Further discussions with DOM people or the browser community may result in additional API changes, but for now, this is the design we're going with.