Skip to content

Commit f8d9b2e

Browse files
committed
Refine the explainer page about what and how
Make the description about what to solve and how to solve spatnav clear
1 parent 20d44a4 commit f8d9b2e

File tree

2 files changed

+58
-22
lines changed

2 files changed

+58
-22
lines changed

.DS_Store

6 KB
Binary file not shown.

explainer.md

Lines changed: 58 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Proposed Model and APIs for spatial navigation
2-
32
## Introduction
43

54
Historically, most browsers have not offered features to let users move the focus directionally.
@@ -12,35 +11,75 @@ such as pressing the <code class=key>Shift</code> key together with arrow keys.
1211
This ability to move around the page directionally is called <strong>spatial navigation</strong>
1312
(or <strong>spatnav</strong> for short).
1413

15-
Spatial navigation can be useful for a webpage built using a grid-like layout,
16-
or other predominantly non linear layouts.
17-
The figure below represents a photo gallery arranged in a grid layout.
18-
If the user presses the <code class=key>Tab</code> key to move focus,
19-
they need to press the key many times to reach the desired element.
20-
Also, the grid layout may arrange the layout of elements independently of their source order.
21-
Therefore sequential navigation using the <code class=key>Tab</code> key makes focus navigation unpredictable.
22-
In contrast, <a>spatial navigation</a> moves the focus among focusable elements
23-
depending on their position
24-
allowing it to address problems encountered with sequential navigation.
14+
## What are we going to solve?
15+
16+
### Supporting spatial navigation on a web page by default
17+
18+
- **Getting devices whose only or primary means of navigation is the D-pad**
19+
20+
Devices like TV, ßIVI, game console mainly use the D-pad for navigating focus directionally.
21+
In the future, the input mechanism such as voice command, hand gesture, eye gazing can be used for navigation.
22+
23+
- **Making life better for users of desktop browsers who use keyboard to navigate**
24+
25+
For non sighted users, spatial navigation may not be in high demand. But for users who have the visual impairment which may be corrected with glasses, using keyboard can be much preferable to using mouse.
26+
27+
- **Using the simple and predictable spatial navigation**
28+
29+
If spatial navigation become default in the browser, it will be easier for authors to implement a web page using this feature without having to write custom navigation code.
30+
Also it ensures the predictable result and reasonable performance of spatial navigation rather than using frameworks which are quite heavy and slow and don't consider all the diversity of use cases.
31+
32+
### Allowing authors to override the default spatial navigation behavior
33+
34+
Spatial navigation is intended to identify the most-likely desired element in the direction of the key press. But "most-likely desired" can depend on the situation.
35+
Our proposal is possible to provide a behavior that performs well in most cases, but it will not be right for all cases. Hence the overriding APIs let authors tune and tweak the default spatial navigation behavior for their intention.
36+
37+
### Motivating Use cases
38+
#### Moving focus to the desired element quickly
39+
How are we going to look through all elements quickly on a webpage?
40+
There are use cases such as:
41+
- **Using a grid-like layout**
2542

26-
<img alt="Illustration of a layout which benefits from spatial navigation" src="images/spatnav-enable.png" style="width: 500px; margin: auto; display: block"/>
43+
The figure below represents a photo gallery arranged in a grid layout.
44+
If the user presses the <code class=key>Tab</code> key to move focus,
45+
they need to press the key many times to reach the desired element.
46+
Also, the grid layout may arrange the layout of elements independently of their source order.
47+
Therefore sequential navigation using the <code class=key>Tab</code> key makes focus navigation unpredictable.
48+
In contrast, <a>spatial navigation</a> moves the focus among focusable elements
49+
depending on their position
50+
allowing it to address problems encountered with sequential navigation.
2751

28-
While arrow keys are naturally suited to control spatial navigation,
29-
pressing them (on devices that have such keys)
30-
has generally triggered other behavior,
31-
such as scrolling.
52+
- **Having too much focusable elements**
53+
54+
Sometimes user don't want to navigate all focusable elements on a web page. If the user just want to move focus to <code>&lt;input></code> elements, they need to keep pressing the <code class=key>Tab</code> key until the focus reaches one of those.
55+
On the other hand, <a>spatial navigation</a> can move focus to <code>&lt;input></code> elements only using overriding APIs.
56+
57+
58+
#### Moving focus just as authors intended
59+
60+
How do we ensure the correct element is focused?
61+
There are some use cases which need interrupting the default spatial navigation and custom handling if necessary.
62+
63+
- **Navigating to the offscreen element within scrollport directly**
64+
65+
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 the 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.
66+
67+
68+
## How are we going to solve?
3269

3370
The [specification of spatial navigation](https://wicg.github.io/spatial-navigation/) introduces the processing model for spatial navigation which explains the default spatial navigation behavior.
3471
Also, it proposes Javascript APIs, Javascript Events, and a CSS property
3572
to extend how spatial navigation work.
3673

37-
## Processing model of Spatial Navigation
74+
### Activating Spatial Navigation
3875
The spec supposes that User Agents decide to activate spatial navigation.
3976
On devices which do not have any pointing input device,
4077
and especially on devices such as TVs which also lack a <code>Tab</code> key to control
4178
<a herf="https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation">sequential focus navigation</a>,
4279
User Agents should make spatial navigation active.
4380

81+
### Processing model
82+
4483
When spatial navigation is active,
4584
pressing an arrow key will either
4685
move the focus from its current location to a new focusable item in the direction requested,
@@ -90,10 +129,8 @@ element of the author's choosing.
90129

91130
The detailed behavior is described in the [Processing Model](https://wicg.github.io/spatial-navigation/#processing-model).
92131

93-
## Overriding the heuristic algorithm
94-
Developers may want to customize the spatial navigation by overriding the heuristic spatial navigation.
95-
96-
### Approach proposed by the current specification
132+
### Overriding the heuristic algorithm
133+
Authors may want to customize the spatial navigation by overriding the heuristic spatial navigation.
97134

98135
Following the principles of [The Extensible Web Manifesto](https://github.com/extensibleweb/manifesto),
99136
the specification exposes Javascript APIs and Events that enable authors to interact with, and if necessary, override the behavior of spatial navigation.
@@ -198,7 +235,6 @@ However, we still included this property, because:
198235
## Demo
199236
- [Blog using the spatial navigation polyfill](https://wicg.github.io/spatial-navigation/demo/blog/)
200237

201-
## Sample
202238
- [Samples using the spatial navigation polyfill](https://wicg.github.io/spatial-navigation/sample/)
203239

204240
- [Samples for testing the implementation in Blink](https://wicg.github.io/spatial-navigation/blink_impl/heuristic_default_move.html)

0 commit comments

Comments
 (0)