Repository navigation
Intent to Migrate Spatial Navigation to the CSSWG #138
Description
(This is filed to document the migration, as it has already been approved by the adopting working group, Editors, and participants in the CG at the time of writing)
Working group decision to adopt
Resolution from the CSS WG to adopt the specification: https://w3.logbot.info/css/20181023#c451857
Pull request doing the move: w3c/csswg-drafts#3324
Proposal
Github Repo: https://github.com/WICG/spatial-navigation
Explainer: https://wicg.github.io/spatial-navigation/
Spec: https://drafts.csswg.org/css-nav-1/
Summary
Spatial navigation is the ability to navigate between focusable elements based on their position within a structured document. Spatial navigation is also often called the directional navigation. This is about a general model for navigating the focus using the arrow keys or similar directional input, as well as related CSS and JavaScript features to enable authors to control it.
Motivation and Use Cases
Some devices, such as TVs or feature-phones have a directional pad and an enter key as the only input usable to navigate a web page.
On other devices, such as an ordinary desktop or laptop computer, other modes of interaction are available, but either due to personal preferences, or to some disabilities, keyboard navigation may be prefered. When that is the case, while sequential navigation using the Tab key is possible, it is not always the preferred approach. The following situations are examples of cases where spatial navigation may be preferred to sequential navigation, to be able to quickly reach the desired element on the page:
Using a grid-like layout
If the user presses the Tab key to move focus, they need to press the key many times to reach the desired element. Also, the grid layout may arrange the layout of elements independently of their source order. Therefore sequential navigation using the Tab key may make focus navigation unpredictable. In contrast, spatial navigation moves the focus among focusable elements depending on their position allowing it to address problems encountered with sequential navigation.
Having too many focusable elements
Sometimes the user doesn't want to navigate all focusable elements on a web page. If a shorter path to the desired target can be visually identified, spatial navigation can be used to get there faster.
Also, using the overriding APIs, the page author can offer the user ways to filter out some the focusable elements if they are not relevant. For example, if the user just wants to move focus to elements, limiting spatial navigation to only focusing these can be achieved using the APIs.
Moving focus just as authors intended
How do we ensure the correct element is focused? The “correct” element to focus when moving directionally is often subjective, and is influenced by many aspects of the page’s visual design. There are some use cases which need overriding the default spatial navigation and providing custom handling is preferrable.
Just as an example, there may be a desire about moving the focus to a hidden element while the user is using spatial navigation on a scrollable area. The default behavior of pressing the arrow key is scrolling if there isn’t any visible element in the scrollport. When the hidden element comes into view, then it can gain the focus. But with proposing overriding APIs, the author can interrupt the default behavior and move the focus directly to it without scrolling first.
Compatibility Risk
New types of layout in the web are emerging (e.g., Flexbox, Grid), so the conventional navigation methodology also needs to evolve to the spatial navigation for a more natural focus movement.
The spatial navigation depends on the visual order, not the DOM order, so the focus movement is more predictable and intuitive than the sequential navigation.
Currently there are many JS libraries for supporting the spatial navigation but providing different features. So it makes user confuse to use the web page, and developers (or service providers) need some amount of development and maintenance costs for their libraries. But the spatial navigation as the standard can guarantee the constant heuristic behavior across the browser.
Ongoing technical constraints
The spatial navigation is useful for the TV whose input device is generally a remote control. Also it is not only for the TV, but also be applied for other devices such as PC and the game console.
There are browsers which already have implemented the spatial navigation. Blink supports the spatial navigation using the arrow keys behind the flag, '--enable-spatial-navigation'.
Link to implementation experience and demos
Polyfill: https://wicg.github.io/spatial-navigation/polyfill/
Demo Center: https://wicg.github.io/spatial-navigation/demo/
Data
TBD.
Security and Privacy
One security risk has been identified (a risk of focus hijacking by hostile iframes), and a solution to this problem has been found (feature policy). Edits are pending: #58
In terms of privacy, the presence of this feature does not reveal anything in particular about the user. A user of the feature would reveal their preference of a particular mode of interaction, but this is no more privacy exposing than the fact that a user of the Tab key reveals their inclination to use the keyboard to navigate.
Accessibility
As this offers an alternative method of navigation, this feature is expected to be an accessibility boost. Existing mechanisms remain usable, but people who were poorly served by them will appreciate the new alternative. In particular, sighted keyboard users, on pages with complex layouts, should find spatial navigation a lot less tedious than sequential navigation.
Internationalization
This feature does not introduce new internationalization concerns. Layout itself is strongly influenced by internationalization and localization, but given that spatial navigation reuses the result of layout, these are automatically handled. Pages with bi-directional text, or mixed writing modes are likely to be easier to navigate using spatial navigation than using sequential navigation, since the visual position of elements is immediately apparent, while the logical order followed by sequential navigation may be somewhat obscured by complex layouts.
Activity
frivoal commentedon Nov 16, 2018
All contributors to the spec are also members of the CSSWG, with one exception: a single commit doing typo and syntax fixes.
Therefore there's no IPR concern.
frivoal commentedon Dec 3, 2018
Open issues migrated (using https://github.com/buildo/gh-issue-mover). Closing