# CSS Spatial Navigation Level 1

## Editor’s Draft, 1 January 1970

Specification Metadata

This version:
  https://drafts.csswg.org/css-nav-1/
Latest published version:
  https://www.w3.org/TR/css-nav-1/
Previous Versions:
  https://www.w3.org/TR/2019/WD-css-nav-1-20190423/
  https://www.w3.org/TR/2019/WD-css-nav-1-20191126/
Editors:
  Jihye Hong (LG Electronics)
  Florian Rivoal (Invited Expert)
Issue Tracking:
  GitHub Issues
Suggest an Edit for this Spec:
  GitHub Editor

Copyright © 1970 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and permissive document license rules apply.

## Abstract

This specification defines a general model for navigating the focus using the arrow keys, as well as related CSS, JavaScript features and Events.

CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc.

## Status of this document

This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.

GitHub Issues are preferred for discussion of this specification. When filing an issue, please put the text “css-nav” in the title, preferably like this: “[css-nav] …summary of comment…”. All issues and comments are archived, and there is also a historical archive.

This document was produced by the CSS Working Group.

This document was produced by a group operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 March 2019 W3C Process Document.

The following features are at-risk, and may be dropped during the CR period:

- `getSpatialNavigationContainer()`
- `focusableAreas()`
- spatial-navigation-contain
- spatial-navigation-action: scroll
- spatial-navigation-function

“At-risk” is a W3C Process term-of-art, and does not necessarily imply that the feature is in danger of being dropped or delayed. It means that the WG believes the feature may have difficulty being interoperably implemented in a timely manner, and marking it as such allows the WG to drop the feature if necessary when transitioning to the Proposed Rec stage, without having to publish a new Candidate Rec without the feature first.

This specification is rather long. To make it easier to read and focus on a particular area, a few checkboxes are provided below. Checking them hides part of the specification. This is only meant as a reading aid, the specification remains the full document.

Hide JavaScript APIs, including events
Hide CSS properties that enable selecting behavior variants, and related information
Hide informative sections that explain and summarize normative sections without adding more information

## 1. Introduction

This section is not normative.

Historically, most browsers have not offered features to let the user move the focus directionally. Some, such as TV browsers, have enabled the user to move the focus using the arrow keys out of necessity, since no other input mechanism is available on a typical TV remote control.

Others have enabled different key combinations to control spatial navigation, such as pressing the `Shift` key together with arrow keys.

This ability to move around the page directionally is called spatial navigation.

Spatial navigation can be useful for a web page built using a grid-like layout, or other predominantly non linear layouts. The figure below represents a photo gallery arranged in a grid layout. If the user presses the `Tab` key to move focus around the images, they need to press the key many times to reach the desired image element.

Photo gallery application example using a grid layout

Also, spatial navigation moves the focus to the predictable element for users because it moves the focus among focusable elements depending on their position. Sometimes elements on the page aren’t arranged independently of their source order. Therefore unlike spatial navigation, sequential navigation using the `Tab` key makes focus navigation unpredictable.

While arrow keys are naturally suited to control spatial navigation, no previous specification describes how that should work, or how it may be controlled. This specification introduces a processing model for spatial navigation, as well as APIs enabling the author to control and override how spatial navigation works.

Note: Some aspects of this specification, such as the JavaScript Events and APIs could also be extended to sequential navigation, in order to make sure that keyboard navigation has a consistent and well defined model in general.

Note: As a general principle, keyboard navigation, and spatial navigation in particular, should be possible to use and control without JavaScript, and declarative solutions are therefore preferred. Since spatial navigation depends on layout, that means CSS is typically the right mechanism to define spatial navigation related controls. However, in the spirit of the Extensible Web Manifesto [EXTENSIBLE], we feel it is important to provide the right JavaScript primitives to let the author experiment and explore the problem space. More declarative features may be added later, based on feedback and experience acquired through such JavaScript usage.

Note: A few features are marked at-risk. The editors of this specification believe they represent an important part of the user or author experience of the features defined in the specification. At the same time, the core functionality of this specification can be implemented without implementing these so it seems possible that implementers may choose to down-prioritize them to reduce the scope of the first implementation. While it is hoped that these features will be implemented as well, they are marked at-risk in recognition that they might not be at first.

## 2. Module interaction

This document depends on the Infra Standard [infra].

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in RFC 2119. [RFC2119]

## 3. Overview

This section is not normative.

Using a UA-defined mechanism (typically arrow keys, possibly in combination with modifier keys like `Shift` or `Control`), the user may ask the User Agent to navigate in a particular direction. This will either move the focus from its current location to a new focusable item in the direction requested, or scroll if there is no appropriate item.

More specifically, the User Agent will first search for visible and focusable items in the direction indicated within the current spatial navigation container (by default, the root element, scrollable elements, and iframes, but other elements can be made into spatial navigation containers using the spatial-navigation-contain property).

If it finds any, it will pick the best one for that direction, and move the focus there.

If it does not, it will scroll the spatial navigation container in the requested direction instead of moving focus. Doing so may uncover focusable elements which would then be eligible targets to move the focus to next time spatial navigation in the same direction is requested.

If the spatial navigation container cannot be scrolled, either because it is not a scrollable element or because it is already scrolled to the maximum in that direction, the User Agent will select the next spatial navigation container up the ancestry chain, and recursively repeat the above process until it finds some element to focus or scroll, or reaches the root element.

Note: As a consequence of this processing model, the elements that are reachable by sequential navigation and by spatial navigation are almost the same. Elements that are currently outside of the viewport of a scrollable element can only be reached by spatial navigation once they have been scrolled into view. Therefore, elements that cannot be scrolled into view by default.

At key points during this search for the appropriate response to the spatial navigation request, the User Agent will fire events. These enable the author to prevent the upcoming action (by calling `preventDefault()`), and if desired to provide an alternate action, such as using the `focus()` method on a different element of the author’s choosing.

To help the author write such alternate actions, and as part of exposing underlying platform primitives as per the Extensible Web principles, this specification also defines JavaScript APIs that expose key constructs of the underlying model.

See § 5 JavaScript API for details about the JavaScript API, § 6.2 Navigation Event Types for details about the various events, and § 9 Controlling spatial navigation through declarative means for details about the CSS properties.

This example shows how a series of focusable elements arranged in a scrollable element would be navigated when using spatial navigation. For the sake of keeping the description simple, this example assumes a User Agent where spatial navigation is triggered using arrow keys.
Moving focus to the visible element in the spatial navigation container.

On the left of figure 2, "Box 2" is focused. Pressing the `ArrowDown` key moves the focus to "Box 3" without scrolling because "Box 3" is visible in the scrollport of the spatial navigation container.

Moving focus to the hidden element in the spatial navigation container.

On the first of figure 3, under "Box 3", there isn’t any visible element in the scrollport. Therefore, the effect of pressing the `ArrowDown` is to scroll down, as shown in the second. The next press of the `ArrowDown` key makes "Box 4" come into the scrollport, and the focus will move to it when there is additional pressing the `ArrowDown`, as the fourth.

This example uses the markup as follows:

    #scroller {
        width: 700px;
        height: 700px;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .box {
        width: 150px;
        height: 110px;
        background-color: blue;
    }

    .box:focus {
        background-color: red;
    }

    <div id="scroller">
        <div class="box" tabindex="0">Box 1</div>
        <div class="box" tabindex="0">Box 2</div>
        <div class="box" tabindex="0">Box 3</div>
        <div class="box" tabindex="0">Box 4</div>
    </div>

## 4. Triggering Spatial Navigation

When the user triggers spatial navigation in a given direction, the User Agent must run the spatial navigation steps in that direction.

This specification does not define what UI mechanism User Agents should offer to users to trigger spatial navigation. This intentionally left for User Agents to decide.

Note: It is expected that User Agents on devices with limited input capabilities, such as TVs operated with a remote control, feature phones, or devices operated with a game controller, will use spatial navigation as their primary or exclusive navigation mechanism.

Although User Agents can implement the processing model and APIs defined by the specification, this specification recommends that User Agents should offer a means for users to trigger spatial navigation directly, without having to use the APIs.

Note: Conversely, the author should assume that spatial navigation may be triggered by the User Agent in response to user actions even if the author has not invoked any of the APIs.

Regardless of the actual mechanism chosen to trigger spatial navigation, the following requirements apply:

- If the mechanism the user must use to trigger spatial navigation would normally fire a `UIEvent`, the event must be fired prior to running the spatial navigation steps and these steps must not be run if that event’s canceled flag gets set.

  Gaming devices may trigger spatial navigation based on pressing the D-pad. This would result in firing a keydown event with the key set to one of `ArrowDown`, `ArrowLeft`, `ArrowRight`, or `ArrowUp`, followed if not canceled by running the spatial navigation steps, including firing the relevant `NavigationEvent`s.

  A User Agent on a desktop computer that triggers spatial navigation using the arrow keys of the keyboard would follow the same sequence.

- If the mechanism the user must use to trigger spatial navigation would also perform other actions in some contexts, the User Agents should in these contexts give priority to these other actions and execute them instead of spatial navigation. It must not trigger both.

  In a User Agent that triggers spatial navigation using the arrow keys without modifier keys, and uses these same arrow keys to move the text insertion caret when an editable element is focused, the arrow keys should by default to moving the caret. Spatial navigation would only be triggered by the arrow keys when the focused element is not editable or when it is editable, but the caret cannot move any further in the requested direction.

  An exception is made for scrolling: since spatial navigation itself handles scrolling (in addition to moving the focus) User Agents should not offer the same mechanism to trigger both spatial navigation and the scrolling behavior separate from spatial navigation. However, User Agents may offer a way for the user to switch between different modes, or offer both based on different UI mechanisms.

  A User Agent may have a setting to let the user choose between using the arrow keys without modifier keys for spatial navigation or for scrolling. Another one may offer scrolling on arrow keys without modifiers, and spatial navigation on arrow keys when pressed together with the `Shift` key, or on the `W` `A` `S` `D` keys. Offering only spatial navigation or only scrolling as responses to pressing arrow keys would also be possibilities.

## 5. JavaScript API

### 5.1. Triggering Navigation Programmatically

The `navigate()` method enables the author to trigger spatial navigation programmatically, as if the user had done so manually (for instance, by pressing the arrow keys in a browser where that is the way to trigger spatial navigation).

Note: As this triggers the same processing model as manual navigation, all the same results should be expected: the same chain of events will be fired and the same element will be scrolled or focused.

Note: The author can use this to trigger spatial navigation based on a different UI mechanism than the one assigned by the User Agent, such as mapping to different keys, or triggering spatial navigation from a clickable on-screen directional pad, or in reaction to other events than UI ones. It could also be used when an author wants to interrupt navigation to do some asynchronous operation (e.g. load more content in an infinite scroller) then resume the navigation where they canceled.

Note: This API is also useful for testing purposes, as there it is difficult to trigger spatial navigation that does not depend on vendor specific UI conventions.

    enum SpatialNavigationDirection {
        "up",
        "down",
        "left",
        "right",
    };

    partial interface Window {
        void navigate(SpatialNavigationDirection dir);
    };

When the `navigate(dir)` method is called, the User Agent must run the following step:

- If direction dir is `"up"`, `"down"`, `"left"`, or `"right"`, run the spatial navigation steps in dir.

The name of this API is under discussion <https://github.com/w3c/csswg-drafts/issues/3387>

### 5.2. Low level APIs

These APIs are designed to be low level constructs following the processing model closely. As such, they should be easy to use by the author who wants to extend or override the way spatial navigation works.

    enum FocusableAreaSearchMode {
        "visible",
        "all"
    };

    dictionary FocusableAreasOption {
        FocusableAreaSearchMode mode;
    };

    dictionary SpatialNavigationSearchOptions {
        sequence<Node>? candidates;
        Node? container;
    };

    partial interface Element {
        Node getSpatialNavigationContainer();
        sequence<Node> focusableAreas(optional FocusableAreasOption option);
        Node? spatialNavigationSearch(SpatialNavigationDirection dir, optional SpatialNavigationSearchOptions options);
    };

Note: The way the direction is expressed allows us to expand to more than 4-way navigation later if this is found necessary. More directional keywords or a numerical angle could be added.

Note: the `focusableAreas()` and `getSpatialNavigationContainer()` methods are at-risk.

When these methods are called, the User Agent must run the steps described below:

`getSpatialNavigationContainer()`

  1. Return the nearest ancestor of the element that is a spatial navigation container, or the document if the nearest spatial navigation container is the viewport.

  Note: If the element is a spatial navigation container, `getSpatialNavigationContainer()` also returns the nearest spatial navigation container, not the element itself.

`focusableAreas(option)`

  1. Let visibleOnly be `false` if option is present and its value is equal to `all`, or `true` otherwise.

  2. Let areas be the result of finding focusable areas within the element with visibleOnly as argument.

  3. Return areas

The following code shows how to get all the visible focusable elements in the current page using `focusableAreas()`. If the method finds a spatial navigation container, it recursively finds focusable areas inside it. Because the value of the `mode` attribute in this method is `visible`, the focusable elements which aren’t inside the scrollport are excluded from the result.

    <body>
        <button></button>
        <div style="width:300px; height:200px; overflow-x: scroll;">
            <button style="left:25px;"></button>
            <button style="left:150px;"></button>
            <button style="left:350px;"></button>
        </div>
    </body>

    const focusableAreas = document.body.focusableAreas({mode: 'visible'});
    focusableAreas && focusableAreas.forEach(focusable => {
      focusable.style.outline = '5px solid red';
    });

The figure below is the result of this code.

Find all visible focusable areas inside the document.

`spatialNavigationSearch(dir, options)`

  1. Let direction be the value of dir.

  2. Let container be

     - if the value of `container` attribute of options is not null,

       - itself, if it is spatial navigation container.

       - its nearest spatial navigation container ancestor, otherwise.

     - else the element’s nearest spatial navigation container ancestor.

  3. Let areas be

     - the value of `candidates` attribute of options if it is not `null`,

     - result of finding focusable areas within container otherwise.

  4. Return the result of selecting the best candidate among areas within container in direction from the element.

Note: When neither a container nor a list of candidates is provided, this only searches through the visible focusable areas of the nearest spatial navigation container ancestor. If there isn’t any, this does not climb further up the ancestry chain, and the result will be `null`.

## 6. Navigation Events

### 6.1. Interface NavigationEvent

The `NavigationEvent` interface provides specific contextual information associated with spatial navigation.

To create an instance of the `NavigationEvent` interface, use the `NavigationEvent` constructor, passing an optional `NavigationEventInit` dictionary.

    [Exposed=Window]
    interface NavigationEvent : UIEvent {
        constructor(DOMString type,
                    optional NavigationEventInit eventInitDict);
        readonly attribute SpatialNavigationDirection dir;
        readonly attribute EventTarget? relatedTarget;
    };

    dictionary NavigationEventInit : UIEventInit {
        SpatialNavigationDirection dir;
        EventTarget? relatedTarget = null;
    };

### 6.2. Navigation Event Types

This section and its subsections are not normative.

The Navigation event types are summarized below. For full normative details, see § 8 Processing Model.

#### 6.2.1. `navbeforefocus`

This event occurs when there is a valid result of selecting the best candidate.

Type | `navbeforefocus`
Interface | `NavigationEvent`
Bubbles | Yes
Cancelable | Yes
Attributes of the event | `Event`.`target` The focused element or if no element focused, then the body element if available, otherwise the root element `NavigationEvent`.`relatedTarget` The DOM anchor of the focusable area that will be focused `NavigationEvent`.`dir` The direction of the navigation as requested by the user

The User Agent dispatches navbeforefocus event before spatial navigation moves the focus. The event target is the element which has focus and the `relatedTarget` is the element which is about to receive focus.

If navigation-override is disabled in the node document of eventTarget for the origin of the active document of the top-level browsing context, this event won’t be dispatched.

This example shows the when pressing the `ArrowRight` key. For the sake of keeping the description simple, this example assumes a User Agent where spatial navigation is triggered using arrow keys.

| Event type | `KeyboardEvent`.`key` | Notes
--- | --- | --- | ---
1 | keydown | `ArrowRight` | MUST be a key which can activate spatial navigation, such as the arrow keys, or spatial navigation is not activated.
2 | navbeforefocus |  | Sent if the candidates for spatial navigation is not `null`, or this is not generated.
3 | focusin |  | Sent before the target element receives focus.
4 | focus |  | Sent after the target element receives focus.

The following code changes the behavior of spatial navigation so that when a scroll container would get focused, if it has at least one visible focusable descendant, the focus is automatically transferred to it, recursively.

    document.addEventListener('navbeforefocus', e => {
        e.preventDefault();

        let nextTarget = e.relatedTarget;
        if (isSpatialNavigationContainer(nextTarget)) {
            const areas = nextTarget.focusableAreas();

            if (areas.length > 0) {
                nextTarget = nextTarget.spatialNavigationSearch(e.dir, { candidates: areas });
            }
        }
        nextTarget.focus();
    });

    function isSpatialNavigationContainer(element) {
        return (!element.parentElement) ||
            (element.nodeName === 'IFRAME') ||
            (isScrollContainer(element)) ||
            (isCSSSpatNavContain(element));
    }

#### 6.2.2. `navnotarget`

This event occurs before going up the tree to search candidates in the nearest ancestor spatial navigation container when spatial navigation has failed to find any candidate within the current spatial navigation container, and in cases where the spatial navigation container is scrollable, when it cannot be scrolled further.

Type | `navnotarget`
Interface | `NavigationEvent`
Bubbles | Yes
Cancelable | Yes
Attributes of the event | `Event`.`target` The focused element or if no element focused, then the body element if available, otherwise the root element `NavigationEvent`.`relatedTarget` The spatial navigation container that was searched in. `NavigationEvent`.`dir` The direction of the navigation as requested by the user

The User Agent dispatches navnotarget event with initializing the event target as the element which has focus and the `relatedTarget` as spatial navigation container of the event target.

If navigation-override is disabled in the node document of eventTarget for the origin of the active document of the top-level browsing context, this event won’t be dispatched.

This example shows the when pressing the `ArrowDown` key in the situation like the following figure. For the sake of keeping the description simple, this example assumes a User Agent where spatial navigation is triggered using arrow keys.
Moving focus when there isn’t any candidate in the scroll container.

| Event type | Event target | `relatedTarget` | Notes
--- | --- | --- | --- | ---
1 | keydown | `#box2` | N/A | MUST be a key which can activate spatial navigation, such as the arrow keys, otherwise spatial navigation is not triggered.
2 | navnotarget | `#box2` | `#scrollContainer` | Sent if `#scrollContainer` doesn’t contain any candidate and cannot be scrolled, otherwise this would not be generated.
3 | navbeforefocus | `#box2` | `#box3` | Sent if the candidates in `#container` is not `null`, otherwise this would not be fired.
4 | focusin | `#box3` | `#box2` | Sent before the target element receives focus.
5 | focus | `#box3` | `#box2` | Sent after the target element receives focus.

The result of this example is the figure as follows:

The result of moving focus when there isn’t any candidate in the scrollport and scroll container cannot be scrolled.

This example uses the markup as follows:

    #container {
        width: 900px;
        height: 1400px;
    }

    #scrollContainer {
        width: 700px;
        height: 700px;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .item {
        width: 150px;
        height: 110px;
        background-color: blue;
    }

    .item:focus {
        background-color: red;
    }

    <div id="container">
        <div id="scrollContainer">
            <div id="box1" class="item" tabindex="0">Box 1</div>
            <div id="box2" class="item" tabindex="0">Box 2</div>
        </div>
        <div id="box3" class="item" tabindex="0">Box 3</div>
    </div>

The following code changes the behavior of spatial navigation to trap the focus within a spatial navigation container which is vertically scrollable. When no further focusable elements can be found in the requested direction and the spatial navigation container cannot be scrolled any further, the focus loops back to the other side instead of moving outside of it.

However, the focus can still be moved outside by sequential navigation, mouse interaction, or programmatic calls to `focus()`.

    scrollContainer.addEventListener('navnotarget', e => {
        let nextTarget = null;
        const verticalDir = ['up', 'down'];
        const candidates = e.relatedTarget.focusableAreas({'mode': 'all'});

        // Prevent default only when navigation direction is on y-axis
        if (verticalDir.includes(e.dir) && (candidates.length > 0)) {
            e.preventDefault();

            if (e.dir === 'down') {
                nextTarget = candidates[0];
            } else if (e.dir === 'up') {
                nextTarget = candidates[candidates.length-1];
            }
            nextTarget.focus();
        }
    });

## 7. The navigation-override policy-controlled feature

The navigation-override policy-controlled feature controls the availability of mechanisms that enables the page author to take control over the behavior of spatial navigation, or to cancel it outright.

- The feature name is "`navigation-override`"

- The default allowlist for navigation-override is "`self`"

As defined in further details in § 8.3 Navigation, if navigation-override is disabled in a document, the navigation events (see § 6 Navigation Events) will not be fired.

Note: This is to prevent a hostile iframe from using these events in order to highjack the focus. We recognize that there exist other mechanisms predating spatial navigation that malicious the author could use to interfere with the user’s ability to control where the focus goes. Despite that, it seems worthwhile to attempt not to increase this attack surface, although it is possible that such attacks are already sufficiently easy to perform that this is a lost cause. Further feedback on this topic, based on experience with implementation or with mitigating such attacks, is very welcome.

## 8. Processing Model

The § 3 Overview section gives a high level idea of how spatial navigation works, to help readers of this specification build a general mental model. It uses intuitive but imprecise terminology, and glosses over many details for the sake of readability.

This section defines the corresponding normative behavior and aims for as much detail as necessary to fully define the behavior.

### 8.1. Glossary

The following term definitions have been specified to explain the processing model for spatial navigation. See the links within the definitions for more information.

The boundary box of an object is defined as follows:

- if the object is a point, the boundary box is that point

- if the object is a box or box fragment, the boundary box is the border box of that box or fragment

- if the object is a focusable area which is not an element, the boundary box is the axis-aligned the bounding box of that focusable area

The inside area of an object is defined as follows:

- if the object is a scroll container, its optimal viewing region

- if the object is a document, the viewport of its browsing context

- if the object is a box or box fragment, its boundary box

- otherwise, the optimal viewing region of its nearest ancestor scroll container

NOTE: If an object is offscreen, the inside area should be the nearest visible ancestor container.

CSS should have a term for “border box taking into account corner shaping properties like border-radius”. <https://github.com/w3c/csswg-drafts/issues/2324>

The search origin is the origin for searching next target.

The spatial navigation starting point is the origin for searching next target which is set by the User Agent. It is initially unset and it can be element or point.

Note: For example, the User Agent could set it to the position of the user’s click if the user clicks on the document contents, and unset when the focus is moved (by spatial navigation or any other means).

If the User Agent sets both a spatial navigation starting point and a sequential focus navigation starting point, they must not be set differently.

### 8.2. Groupings of elements

While the processing model for spatial navigation is to work from the layout of the document and the relative position of focusable elements, the User Agent is required to prioritize finding elements from a local logical grouping, only looking for focusable elements outside of the grouping if a suitable one cannot be found inside it (see § 8.3 Navigation for details).

Such groupings are called spatial navigation containers.

By default, spatial navigation containers are established by:

- The viewport of a browsing context (not limited to the top-level browsing context)

- scroll containers

Additional spatial navigation containers can be created using the spatial-navigation-contain property (see § 9.1 Creating additional spatial navigation containers: the spatial-navigation-contain property).

### 8.3. Navigation

The processing model for spatial navigation describes how spatial navigation works in general.

Overview of the Spatial navigation processing model
This figure is not normative. It gives an overview of the processing model further defined in this section, assuming that the spatial-navigation-action property has its initial value of auto.

To run the spatial navigation steps in direction, do the following:

1. Let searchOrigin be the result of setting the search origin.

2. - If searchOrigin is an node, let eventTarget be searchOrigin

   - else (assert: searchOrigin is a position) let eventTarget be the node which contains searchOrigin

3. If eventTarget is the Document or the document element, set eventTarget be the body element if it is not `null` or to the document element otherwise.

4. - If eventTarget is scroll container and the computed value of the spatial-navigation-action property on eventTarget is scroll and eventTarget can be manually scrolled, then directionally scroll the element eventTarget and return.
   - Else, if eventTarget is either a scroll container or the document

     1. Let candidates be the result of finding focusable areas within eventTarget with the argument visibleOnly set to `false` if computed value of the spatial-navigation-action property on eventTarget is focus or to `true` otherwise.

     2. - If the computed value of the spatial-navigation-action property on eventTarget is not focus and eventTarget can be manually scrolled, then directionally scroll the element eventTarget in direction and return.
        - Else if candidates contains at least 1 item:

          1. Let bestCandidate be the result of selecting the best candidate within candidates in direction starting from searchOrigin

          2. Dispatches navbeforefocus event at eventTarget with direction and bestCandidate.

          3. Run the focusing steps for bestCandidate and return

        - Else, fall back to the next step.
   - Else, fall back to the next step.

5. Let container be the nearest ancestor of eventTarget that is a spatial navigation container.

6. Loop: Let candidates be the result of finding focusable areas within container with the argument visibleOnly set to `false` if computed value of the spatial-navigation-action property on container is focus or to `true` otherwise, excluding eventTarget

7. If candidates is empty:

8. If the computed value of the spatial-navigation-action property on container is not focus and container is a scroll container that can be manually scrolled, directionally scroll the element container in direction and return.
9. Else,

   1. Dispatches navnotarget event at eventTarget with direction and container.

   2. - If container is the document element of the top-level browsing context, then return. The User Agent may transfer focus to its own controls (if any) honouring direction.

      - Else, if container is the document element of a nested browsing context then:

        1. Set searchOrigin to container’s browsing context container

        2. Set eventTarget be searchOrigin

        3. Set container to the nearest ancestor of eventTarget that is a spatial navigation container.

        4. Return to the step labeled loop.

      - Else, set container to its closest ancestor that is itself a spatial navigation container and return to the step labeled loop.

10. Let bestCandidate be the result of selecting the best candidate within candidates in direction starting from eventTarget.

11. Dispatches navbeforefocus event at eventTarget with direction and bestCandidate.

12. Run the focusing steps for bestCandidate and return.

### 8.4. Focus Navigation Heuristics

Note: The following algorithms are inspired from Chrome’s implementation as well as from the old WICD Spec. Implementors who find better approaches or refinements to these approaches are strongly encouraged to provide feedback and help improve this specification in order to maximize interoperability. In particular, divergences in how User Agents find focusable areas may cause some elements to be focusable in some User Agents but not in others, which would be bad for users.

All geometrical operations in this section are defined to work on the result of CSS layout, including all graphical transformations, such as relative positioning or [CSS-TRANSFORMS-1].

To set the search origin, run the following steps:

1. Let searchOrigin be the DOM anchor of the currently focused area of a top-level browsing context.

2. If the spatial navigation starting point is not `null` and it is inside searchOrigin, then return it.

3. Otherwise, return searchOrigin.

If the status of focus target changed not by moving the focus, update the search origin as following:

1. If focus target becomes actually disabled or expressly inert or not being rendered, then let searchOrigin be the boundary box of focus target.

2. If focus target is removed, then let searchOrigin be the boundary box of focus target with the position of focus target when it existed.

3. If focus target is completely off-screen, then let searchOrigin be the viewport of focus target’s nearest visible spatial navigation container.

NOTE: The User Agent should update the search origin, for example, when the focused element was scrolled out by mouse scrolling or vanished from the viewport.

To find focusable areas within a containing element C, with an optional visibleOnly argument that defaults to `true`, run the following steps:

1. Let focusables be the set of all the focusable areas whose DOM anchor are descendants of C. In the case of boxes with several box fragments, each box fragment is considered separately.

2. The User Agent should remove from focusables items that have a DOM anchor whose `tabindex` attribute is set to a negative value.

   Note: This is a "SHOULD" in order to mirror the exclusion of elements with negative tabindex from the sequential focus navigation order as defined in tabindex.

3. If visibleOnly is `false`, return focusables.

   Note: focusables may be empty

4. Let visibles be the subset of items in focusables whose boundary box is at least partly within the inside area of C.

   Except for elements that are in the currently non visible part of a scroller, spatial navigation does not automatically exclude elements which cannot be clicked on, for example, due to being obscured by some other element. To avoid breaking assumptions in the application logic if a user actually focuses and activates such an element, and to avoid confusing users by focusing invisible or apparently unreachable elements, the author should use make these elements unreachable to spatial navigation using the same best practices as for making elements unreachable to sequential navigation, such as using `tab-index="-1"` or the `inert` attribute.

5. Return visibles.

   Note: visibles may be empty

To select the best candidate within a set of candidates in a direction dir, starting from searchOrigin, run the following steps:

1. If candidates is empty, return `null`

2. If candidates contains a single item, return that item

3. Let insiders be the subset of candidates

   - whose boundary box fully overlaps with inside area of searchOrigin

   - whose boundary box partially overlaps with inside area of searchOrigin as

     - top edge is below the top edge of searchOrigin’s boundary box if dir is `down`

     - bottom edge is above the bottom edge of searchOrigin’s boundary box if dir is `up`

     - right edge is left of the right edge of searchOrigin’s boundary box if dir is `left`

     - left edge is right of the left edge of searchOrigin’s boundary box if dir is `right`

     NOTE: More detail condition about how the element is overlapped with the search origin affects the sequence of focus movement. The sequence of focus movement is related to UX, so it depends on the UA-defined mechanism.

   Note: this sub-setting is necessary to avoid going in the opposite direction than the one requested.

4. - If insiders is non empty,

     1. Let closest subset be the subset of insiders whose boundary box’s

        - top edge is closest to the top edge of inside area of searchOrigin if dir is `down`

        - bottom edge is closest to the bottom edge of inside area of searchOrigin if dir is `up`

        - right edge is closest to the right edge of inside area of searchOrigin if dir is `left`

        - left edge is closest to the left edge of inside area of searchOrigin if dir is `right`

     2. If closest subset contains a single item, return that item, else return the first item of closest subset in document order, unless its boundary box overlaps with the boundary box of another item and that item is higher in the CSS painting order. In that case, return that item instead, unless it too is overlapped with another higher item, recursively.

   - Else

     1. Set candidates be the subset of its items which satisfies one of the following conditions:

        - the item doesn’t overlap with searchOrigin and its boundary box’s

          - top edge is below the bottom edge of searchOrigin’s boundary box if dir is `down`

          - bottom edge is above the top edge of searchOrigin’s boundary box if dir is `up`

          - right edge is left of the left edge of searchOrigin’s boundary box if dir is `left`

          - left edge is right of the right edge of searchOrigin’s boundary box if dir is `right`

     2. For each candidate in candidates, find the shortest distance between searchOrigin.

     3. Return the item of the candidates set that has the smallest distance. If several have the same distance, return the first one in document order, unless its boundary box overlaps with the boundary box of another item at the same distance, and that item is higher in the CSS painting order. In that case, return that item instead, unless it too is overlapped with another higher item at the same distance, recursively.

To find the shortest distance between a reference and a candidate in direction dir, find the points P1 and P2, respectively within the boundary boxes of the reference and of the candidate, that minimize the distance as defined as below:

    distance = euclidean + displacement - alignment - sqrt(Overlap)

The meaning of each term is as follows:

euclidean
  The euclidean distance between P1 and P2
displacement
  The degree of displacement in dir between the reference and the candidate, defined as

      displacement = (absolute distance on the axis orthogonal to dir between P1 and P2 +
                      orthogonalBias) *
                     orthogonalWeight

orthogonalBias:

  - If the dir is `left` or `right`, the height of the axis-aligned bounding box of reference / 2

  - Else if the dir is `up` or `down`, the width of the axis-aligned bounding box of reference / 2

orthogonalWeight:

  - If the dir is `left` or `right`, 30

  - Else if the dir is `up` or `down`, 2

alignment
  The degree of alignment in dir between the reference and the candidate, defined as:

      alignment = alignBias * alignWeight

alignBias:

  - If the dir is `left` or `right`, projectedOverlap / height of the axis-aligned bounding box of reference

  - Else if the dir is `up` or `down`, projectedOverlap / width of the axis-aligned bounding box of reference

projectedOverlap:

  - If the dir is `left` or `right`, the length of the overlap between the horizontal projections onto the vertical axis of the reference and the candidate

  - Else if the dir is `up` or `down`, the length of the overlap between the vertical projections onto the horizontal axis of the reference and the candidate

  projectedOverlap
alignWeight:
  5
sqrt(Overlap)
  The square root of area of overlap between the reference and the candidate, or 0 if they do not overlap.

Note: This general formula was picked from several plausible alternatives, based on which one most often matches intuition when used to select the best candidate in a series of UX test cases. Similarly, the values of alignWeight and orthogonalWeight were also determined experimentally based on the same test cases. The resulting formula is somewhat complicated, but seems to give good answers. Suggestions for improvements or simplifications are welcome.

## 9. Controlling spatial navigation through declarative means

### 9.1. Creating additional spatial navigation containers: the spatial-navigation-contain property

Name: | spatial-navigation-contain
Value: | auto | contain
Initial: | auto
Applies to: | all elements
Inherited: | no
Percentages: | n/a
Computed value: | as specified
Canonical order: | per grammar
Animation type: | discrete

auto
  If the element is a scroll container then it establishes a spatial navigation container, otherwise it does not.
contain
  The element establishes a spatial navigation container

Note: In addition, as per § 8.2 Groupings of elements, the viewport of a browsing context (not limited to the top-level browsing context) also establishes a spatial navigation container.

The following example shows a simplified TV program schedule or calendar. It has a grid of elements representing TV shows or calendar entries and some UI buttons around it.

In this case, the grid is quite sparse, so if the user tries to move down from "Foo", focus would be moved to "Next Week", as it is objectively closer in the down direction. The same is true for going down from "Bar": the focus would move to "Previous Week".

| M | T | W | T | F | S | S
0-6 |  |  |  |  |  |  | Foo
6-9 | Bar |  |  |  |  |  |
9-12 |  | Bat |  |  |  |  |
12-18 |  |  |  |  |  |  |
18-21 |  |  |  |  |  |  | Woo
21-24 |  |  |  |  |  | Baz |

    <div>
        <button>Previous Week</button>
        <table>
            <tr><td><th>M<th>T<th>W<th>T<th>F<th>S<th>S
            <tr><td>0-6<td><td><td><td><td><td><td><a href="#">Foo</a>
            <tr><td>6-9<td><a href="#">Bar</a><td><td><td><td><td><td>
            <tr><td>9-12<td><td><a href="#">Bat</a><td><td><td><td><td>
            <tr><td>12-18<td><td><td><td><td><td><td>
            <tr><td>18-21<td><td><td><td><td><td><td><a href="#">Woo</a>
            <tr><td>21-24<td><td><td><td><td><td><a href="#">Baz</a><td>
        </table>
        <button>Next Week</button>
    </div>

However, the author may want to provide a different navigation experience giving priority to movements inside the grid once you have focused one of its items because the elements in the table are semantically related to each other.

Adding `table { spatial-navigation-contain: contain; }` to the stylesheet would result this behavior.

After that, the focus would move down from "Foo" to "Woo" instead of "Next Week", and from "Bar" to "Bat" instead of "Previous Week".

It would still be possible to move the focus out of the table. For example, the focus would move to "Next week" by going right from "Foo" since there is nothing in the grid that is to the right.

Note: the spatial-navigation-contain property is at-risk.

### 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property

Name: | spatial-navigation-action
Value: | auto | focus | scroll
Initial: | auto
Applies to: | scroll containers
Inherited: | no
Percentages: | n/a
Computed value: | as specified
Canonical order: | per grammar
Animation type: | discrete

When the focus is inside of a scroll container and the user triggers spatial navigation, it is somewhat ambiguous whether they are requesting that the focus be moved in that direction, or whether the document should be scrolled in that direction. By default, this is automatically determined, but this property allows the author to decide between focusing or scrolling.

The precise behavior is defined in § 8.3 Navigation, but a high level description of the effect of each value is provided below.

When spatial navigation is triggered, the behavior depends on the value of the spatial-navigation-action on the currently focused element if that element is a scroll container, or of its nearest scroll container ancestor if it isn’t.

auto
  If there are visible focusable elements within the scroll container in the direction requested, the closest one becomes focused. Otherwise, the scroll container is scrolled in the direction requested.
focus
  The focus is moved to the nearest focusable element within the scroll container, regardless of whether it is visible. If there are none, the scroll container is not scrolled, and the search continues up the ancestry chain instead.

  Note: The scroll container may be scrolled as a side effect of focusing an element which was previously not in view, but it will not be directionally scrolled.

  Note: If the focus value is given to spatial-navigation-action, navnotarget event occurs when there isn’t any visible candidate in the given direction within the viewport of the spatial navigation container even if the container can be scrolled more.

scroll
  If the currently focused element is not itself a scroll container, this value on an ancestor scroll container has the same effect as auto.

  If the currently focused element is a scroll container, it is scrolled in the direction requested without changing which element is in focus, regardless of the presence of focusable descendants.

  Note: This means that spatial navigation can be used to move the focus to a scroll container and to scroll it, but not to move the focus to its descendants. However, if the focus is moved to a descendant by some other mean (such as pressing the Tab key or using the <`focus()`> method) spatial navigation can be used to move the focus to other focusable descendants.

  Note: The scroll value is at-risk.

Note: Earlier version of this specification did not offer a declarative way to opt into the behavior defined by focus, and instead offered a cancellable event that would be fired before scrolling, so that the author could implement that behavior themselves. However, cancellable events related to scrolling can cause performance problems, so this event was removed and the spatial-navigation-action property was introduced instead.

In this example, a scrollable container is specified with `spatial-navigation-action: focus`. Inside the container, there is an element which is out of the view within a scrollport. Pressing the down arrow key moves the focus directly to it without scrolling manually.
Moving focus from "Box 2" to "Box 3" without manually scrolling

    <div class='scroller'>
        <button class='item'>Box 1</button>
        <button class='item'>Box 2</button>
        <button class='item'>Box 3</button>
    </div>

    .scroller {
        display: grid;
        grid-template-columns: repeat(1, 1fr);
        height: 300px;
        width: 200px;
        overflow-y: scroll;
        spatial-navigation-action: focus;
    }
    .item {
        height: 100px;
        width: 100px;
        margin: 50px auto;
        background-color: blue;
    }
    :focus {
        background-color: red;
    }

### 9.3. Selecting the navigation algorithm: the spatial-navigation-function property

Name: | spatial-navigation-function
Value: | normal | grid
Initial: | normal
Applies to: | spatial navigation containers
Inherited: | no
Percentages: | n/a
Computed value: | as specified
Canonical order: | per grammar
Animation type: | discrete

The default algorithm of spatial navigation specified in the § 8 Processing Model may need the fine tune depending on the layout types. This property allows the author to indicate which navigation algorithm is reasonable for spatial navigation behavior.

Its values are defined as follows:

normal
  Moves the focus with the default focus navigation algorithm defined by UA.

  In general, the focus moves to the element with the closest distance calculated by finding the shortest distance.

grid
  Moves the focus to the element which is aligned most in the navigation direction.

  - If there are more than one aligned candidates in the navigation direction, select the element with the closest distance along the axis which corresponds to the navigation direction. In case of multiple elements with the same distance, select the element with the minimum amount of alignment.

  - Else if there isn’t any aligned candidate in a given direction, select the element with the closest distance along the axis which corresponds to the navigation direction. In case of multiple elements with the same distance, select the element with the minimum distance along the axis which is orthogonal to the navigation direction.

NOTE: These values are negotiated with the users' preferences which seems natural spatial navigation behavior for their pages.

This example shows how the focus moves differently by the value of `spatial-navigation-function`.
Moving focus from "A" to one of the candidate elements

Let the element which contains "A", "B" and "C" is the spatial navigation container.

When the user presses the down arrow key, if `normal` value is given to `spatial-navigation-function` of the element, the focus will move to "B". Otherwise, `grid` value was specified to the element, the focus will move to "C".

## Appendix A. Scroll extensions

This section proposes a few extensions to CSS that should be integrated in upstream specifications, but are hosted here until then.

Terminology like this should be in [CSSOM-VIEW-1], [CSS-OVERFLOW-3], [CSS-SCROLL-SNAP-1]. <https://github.com/w3c/csswg-drafts/issues/2322>

An element e can be manually scrolled in a given direction d if:

- The principal box established by e is a scroll container, and

- if d is `up` or `down`, the computed value of the overflow-y property is not hidden, and

- if d is `left` or `right`, the computed value of the overflow-x property is not hidden, and

- e is not at the scroll boundary in the direction d

- e is not snapped to the last mandatory snap point in direction d

[CSSOM-VIEW-1] should probably define how to perform a scroll in a given direction without an explicit position. Until then, we roll our own. <https://github.com/w3c/csswg-drafts/issues/2323>

To directionally scroll an element e in direction dir:

1. Let d be a User Agent defined distance.

2. Let x be e’s current scroll position on the x axis.

3. Let y be e’s current scroll position on the y axis.

4. Use the scroll an element algorithm from [CSSOM-VIEW-1] on e to

   - (x, y - d) if dir is `up`

   - (x, y + d) if dir is `down`

   - (x - d, y) if dir is `left`

   - (x + d, y) if dir is `right`

## Appendix B. Privacy and Security Considerations

The specification contributors believe that all known potential security risks associated with this specification have been adequately addressed. Further details are provided below.

The TAG has developed a self-review questionaire to help editors and Working Groups evaluate the risks introduced by their specifications. Answers are provided below.

Does this specification deal with personally-identifiable information?
  No.
Does this specification deal with high-value data?
  No.
Does this specification introduce new state for an origin that persists across browsing sessions?
  No.
Does this specification expose persistent, cross-origin state to the web?
  No.
Does this specification expose any other data to an origin that it doesn’t currently have access to?
  Mostly, no.

  The one exception identified would be in the following scenario: if the author uses `window.navigate` while the focus is in a cross origin iframe, if they don’t get an event at all it means that either there was something scrollable or focusable within the iframe, as the only case where they’d get an event is when the search didn’t find anything at all goes up the tree.

  This is so limited information that it does not seem it would introduces real a security risk, but it is as far as the editors can tell information that the author could not get could not get otherwise.

Does this specification enable new script execution/loading mechanisms?
  No.
Does this specification allow an origin access to a user’s location?
  No.
Does this specification allow an origin access to sensors on a user’s device?
  No.
Does this specification allow an origin access to aspects of a user’s local computing environment?
  No.
Does this specification allow an origin access to other devices?
  No.
Does this specification allow an origin some measure of control over a user agent’s native UI?
  No control is given over the appearance of the User Agent’s UI. Some control is given over how the User Agent performs spatial navigation, which may be considered part of its user interface. This is intentional, to let the author tailor the behavior of spatial navigation to their pages. To prevent malicious the author to interefere with the users' desire to control focus and navigate the document, this overriding mechanism is disabled by default for cross-origin iframes. See § 7 The navigation-override policy-controlled feature.
Does this specification expose temporary identifiers to the web?
  No.
Does this specification distinguish between behavior in first-party and third-party contexts?
  No.
How should this specification work in the context of a user agent’s "incognito" mode?
  No Difference.
Does this specification persist data to a user’s local device?
  No.
Does this specification have a "Security Considerations" and "Privacy Considerations" section?
  Yes, this is the section you are reading now.
Does this specification allow downgrading default security characteristics?
  It does not allow downgrading any unrelated security mechanism.

  It **does** allow the author to opt into allowing the events needed to override the default behavior of spatial navigation in cross origin iframes they trust using [feature-policy]. See § 7 The navigation-override policy-controlled feature.

## Acknowledgements

The editors of this specification would like to thank the following individuals for their feedback and contributions (in alphabetical order):

- Alice Boxhall

- Brian Kardell

- Elika Etemad

- Eric Seong

- Hugo Holgersson

- Hyojin Song

- Jeonghee Ahn

- Junho Seo

- Rob Dodson

- Seungcheon Baek

## Changes

This section is non-normative.

The following changes were made since the 23 April 2019 First Public Working Draft.

- Changed the result of `getSpatialNavigationContainer()` to return the nearest spatial navigation container ancestor

- Added spatial-navigation-function

- Added updating the search origin step

- Changed the IDL of `spatialNavigationSearch()` as separating the dir attribute from `SpatialNavigationSearchOptions`

- Made the focusable element fully overlapped with search origin which is not the spatial navigation container as a candidate for fixing the unreachability

## Conformance

### Document conventions

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words “for example” or are set apart from the normative text with `class="example"`, like this:

This is an example of an informative example.

Informative notes begin with the word “Note” and are set apart from the normative text with `class="note"`, like this:

Note, this is an informative note.

Advisements are normative sections styled to evoke special attention and are set apart from other normative text with `<strong class="advisement">`, like this: UAs MUST provide an accessible alternative.

### Conformance classes

Conformance to this specification is defined for three conformance classes:

style sheet
  A CSS style sheet.
renderer
  A UA that interprets the semantics of a style sheet and renders documents that use them.
authoring tool
  A UA that writes a style sheet.

A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module.

A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.)

An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module.

### Requirements for Responsible Implementation of CSS

The following sections define several conformance requirements for implementing CSS responsibly, in a way that promotes interoperability in the present and future.

#### Partial Implementations

So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers must treat as invalid (and ignore as appropriate) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents must not selectively ignore unsupported property values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.

#### Implementations of Unstable and Proprietary Features

To avoid clashes with future stable CSS features, the CSSWG recommends following best practices for the implementation of unstable features and proprietary extensions to CSS.

#### Implementations of CR-level Features

Once a specification reaches the Candidate Recommendation stage, implementers should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec, and should avoid exposing a prefixed variant of that feature.

To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group.

Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at http://www.w3.org/Style/CSS/Test/. Questions should be directed to the public-css-testsuite@w3.org mailing list.

## Index

### Terms defined by this specification

- "all", in §5.2
- at-risk, in §1
- auto
  - value for spatial-navigation-action, in §9.2
  - value for spatial-navigation-contain, in §9.1
- be directionally scrolled, in §Unnumbered section
- boundary box, in §8.1
- can be manually scrolled, in §Unnumbered section
- can be scrolled manually, in §Unnumbered section
- candidates, in §5.2
- cannot be manually scrolled, in §Unnumbered section
- cannot be scrolled manually, in §Unnumbered section
- constructor(type), in §6.1
- constructor(type, eventInitDict), in §6.1
- contain, in §9.1
- container, in §5.2
- dir
  - attribute for NavigationEvent, in §6.1
  - dict-member for NavigationEventInit, in §6.1
- directionally scroll an element, in §Unnumbered section
- directionally scroll the element, in §Unnumbered section
- dispatches navbeforefocus event, in §6.2.1
- dispatches navnotarget event, in §6.2.2
- dispatching navbeforefocus event, in §6.2.1
- dispatching navnotarget event, in §6.2.2
- "down", in §5.1
- find focusable areas, in §8.4
- finding focusable areas, in §8.4
- finding the shortest distance, in §8.4
- find the shortest distance, in §8.4
- focus, in §9.2
- focusableAreas(), in §5.2
- FocusableAreaSearchMode, in §5.2
- focusableAreas(option), in §5.2
- FocusableAreasOption, in §5.2
- getSpatialNavigationContainer(), in §5.2
- grid, in §9.3
- inside area, in §8.1
- "left", in §5.1
- mode, in §5.2
- navbeforefocus, in §6.2.1
- navigate(dir), in §5.1
- NavigationEvent, in §6.1
- NavigationEventInit, in §6.1
- NavigationEvent(type), in §6.1
- NavigationEvent(type, eventInitDict), in §6.1
- navigation-override, in §7
- navnotarget, in §6.2.2
- normal, in §9.3
- relatedTarget
  - attribute for NavigationEvent, in §6.1
  - dict-member for NavigationEventInit, in §6.1
- "right", in §5.1
- scroll, in §9.2
- search origin, in §8.1
- selecting the best candidate, in §8.4
- select the best candidate, in §8.4
- set the search origin, in §8.4
- setting the search origin, in §8.4
- spatial navigation, in §1
- spatialNavigation, in §1
- spatial-navigation-action, in §9.2
- spatial-navigation-contain, in §9.1
- spatial navigation containers, in §8.2
- SpatialNavigationDirection, in §5.1
- spatial-navigation-function, in §9.3
- spatialNavigationSearch(dir), in §5.2
- spatialNavigationSearch(dir, options), in §5.2
- spatialNavigationSearch(options), in §5.2
- SpatialNavigationSearchOptions, in §5.2
- spatial navigation starting point, in §8.1
- spatial navigation steps, in §8.3
- "up", in §5.1
- update the search origin, in §8.4
- updating the search origin, in §8.4
- "visible", in §5.2

https://drafts.csswg.org/css-break-4/#box-fragment Referenced in:

- 8.1. Glossary (2)
- 8.4. Focus Navigation Heuristics (2)

https://drafts.csswg.org/css-cascade-4/#propdef-all Referenced in:

- 5.2. Low level APIs

https://drafts.csswg.org/css-display-3/#box Referenced in:

- 8.1. Glossary (2)
- 8.4. Focus Navigation Heuristics

https://drafts.csswg.org/css-display-3/#principal-box Referenced in:

- Appendix A. Scroll extensions

https://drafts.csswg.org/css-overflow-3/#valdef-overflow-hidden Referenced in:

- Appendix A. Scroll extensions (2)

https://drafts.csswg.org/css-overflow-3/#propdef-overflow-x Referenced in:

- Appendix A. Scroll extensions

https://drafts.csswg.org/css-overflow-3/#propdef-overflow-y Referenced in:

- Appendix A. Scroll extensions

https://drafts.csswg.org/css-overflow-3/#scroll-container Referenced in:

- 6.2.2. navnotarget (2)
- 8.1. Glossary (2)
- 8.2. Groupings of elements
- 8.3. Navigation (2) (3)
- 9.1. Creating additional spatial navigation containers: the spatial-navigation-contain property
- 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property (2) (3) (4) (5) (6) (7) (8) (9) (10) (11)
- Appendix A. Scroll extensions

https://drafts.csswg.org/css-overflow-3/#scrollport Referenced in:

- 3. Overview (2) (3)
- 5.2. Low level APIs
- 6.2.2. navnotarget
- 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property

https://drafts.csswg.org/css-position-3/#relative-position Referenced in:

- 8.4. Focus Navigation Heuristics

https://drafts.csswg.org/css-scroll-snap-1/#valdef-scroll-snap-type-mandatory Referenced in:

- Appendix A. Scroll extensions

https://drafts.csswg.org/css-scroll-snap-1/#optimal-viewing-region Referenced in:

- 8.1. Glossary (2)

https://drafts.csswg.org/css-values-4/#mult-one-plus Referenced in:

- 8.4. Focus Navigation Heuristics

https://drafts.csswg.org/css-values-4/#comb-one Referenced in:

- 9.1. Creating additional spatial navigation containers: the spatial-navigation-contain property
- 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property (2)
- 9.3. Selecting the navigation algorithm: the spatial-navigation-function property

https://drafts.csswg.org/css2/box.html#x14 Referenced in:

- 8.1. Glossary

https://drafts.csswg.org/css2/zindex.html#painting-order Referenced in:

- 8.4. Focus Navigation Heuristics (2)

https://drafts.csswg.org/cssom-view-1/#scroll-an-element Referenced in:

- Appendix A. Scroll extensions

https://dom.spec.whatwg.org/#element Referenced in:

- 5.2. Low level APIs

https://dom.spec.whatwg.org/#event Referenced in:

- 6.2.1. navbeforefocus
- 6.2.2. navnotarget

https://dom.spec.whatwg.org/#eventtarget Referenced in:

- 6.1. Interface NavigationEvent (2)

https://dom.spec.whatwg.org/#node Referenced in:

- 5.2. Low level APIs (2) (3) (4) (5)

https://dom.spec.whatwg.org/#canceled-flag Referenced in:

- 4. Triggering Spatial Navigation

https://dom.spec.whatwg.org/#concept-document Referenced in:

- 5.2. Low level APIs
- 8.1. Glossary
- 8.3. Navigation (2)

https://dom.spec.whatwg.org/#document-element Referenced in:

- 8.3. Navigation (2) (3) (4)

https://dom.spec.whatwg.org/#boundary-point-node Referenced in:

- 8.3. Navigation (2)

https://dom.spec.whatwg.org/#concept-node-document Referenced in:

- 6.2.1. navbeforefocus
- 6.2.2. navnotarget

https://dom.spec.whatwg.org/#dom-event-preventdefault Referenced in:

- 3. Overview

https://dom.spec.whatwg.org/#dom-event-target Referenced in:

- 6.2.1. navbeforefocus
- 6.2.2. navnotarget

https://w3c.github.io/webappsec-feature-policy/#default-allowlist Referenced in:

- 7. The navigation-override policy-controlled feature

https://w3c.github.io/webappsec-feature-policy/#policy-controlled-feature Referenced in:

- 7. The navigation-override policy-controlled feature (2)

https://html.spec.whatwg.org/multipage/window-object.html#window Referenced in:

- 5.1. Triggering Navigation Programmatically

https://html.spec.whatwg.org/multipage/browsers.html#active-document Referenced in:

- 6.2.1. navbeforefocus
- 6.2.2. navnotarget

https://html.spec.whatwg.org/multipage/semantics-other.html#concept-element-disabled Referenced in:

- 8.4. Focus Navigation Heuristics

https://html.spec.whatwg.org/multipage/rendering.html#being-rendered Referenced in:

- 8.4. Focus Navigation Heuristics

https://html.spec.whatwg.org/multipage/browsers.html#browsing-context Referenced in:

- 8.1. Glossary
- 8.2. Groupings of elements
- 9.1. Creating additional spatial navigation containers: the spatial-navigation-contain property

https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-container Referenced in:

- 8.3. Navigation

https://html.spec.whatwg.org/multipage/interaction.html#currently-focused-area-of-a-top-level-browsing-context Referenced in:

- 8.4. Focus Navigation Heuristics

https://html.spec.whatwg.org/multipage/interaction.html#dom-anchor Referenced in:

- 8.4. Focus Navigation Heuristics (2) (3)

https://html.spec.whatwg.org/multipage/interaction.html#expressly-inert Referenced in:

- 8.4. Focus Navigation Heuristics

https://html.spec.whatwg.org/multipage/interaction.html#dom-focus Referenced in:

- 3. Overview
- 6.2.2. navnotarget
- 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property

https://html.spec.whatwg.org/multipage/interaction.html#focusable-area Referenced in:

- 8.1. Glossary (2)
- 8.4. Focus Navigation Heuristics

https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps Referenced in:

- 8.3. Navigation (2)

https://html.spec.whatwg.org/multipage/browsers.html#nested-browsing-context Referenced in:

- 8.3. Navigation

https://html.spec.whatwg.org/multipage/origin.html#concept-origin Referenced in:

- 6.2.1. navbeforefocus
- 6.2.2. navnotarget

https://html.spec.whatwg.org/multipage/infrastructure.html#nodes-are-removed Referenced in:

- 8.4. Focus Navigation Heuristics

https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation-order Referenced in:

- 8.4. Focus Navigation Heuristics

https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation-starting-point Referenced in:

- 8.1. Glossary

https://html.spec.whatwg.org/multipage/interaction.html#attr-tabindex Referenced in:

- 8.4. Focus Navigation Heuristics (2)

https://html.spec.whatwg.org/multipage/dom.html#the-body-element-2 Referenced in:

- 6.2.1. navbeforefocus
- 6.2.2. navnotarget
- 8.3. Navigation

https://html.spec.whatwg.org/multipage/browsers.html#top-level-browsing-context Referenced in:

- 6.2.1. navbeforefocus
- 6.2.2. navnotarget
- 8.2. Groupings of elements
- 8.3. Navigation
- 9.1. Creating additional spatial navigation containers: the spatial-navigation-contain property

https://infra.spec.whatwg.org/#assert Referenced in:

- 8.3. Navigation

https://infra.spec.whatwg.org/#list-empty Referenced in:

- 8.4. Focus Navigation Heuristics

https://infra.spec.whatwg.org/#list-remove Referenced in:

- 8.4. Focus Navigation Heuristics

https://infra.spec.whatwg.org/#ordered-set Referenced in:

- 8.4. Focus Navigation Heuristics (2)

https://drafts.csswg.org/css-overscroll-behavior-1/#scroll-boundary Referenced in:

- Appendix A. Scroll extensions

https://www.w3.org/TR/uievents/#keyboardevent Referenced in:

- 6.2.1. navbeforefocus

https://www.w3.org/TR/uievents/#uievent Referenced in:

- 4. Triggering Spatial Navigation
- 6.1. Interface NavigationEvent

https://www.w3.org/TR/uievents/#dictdef-uieventinit Referenced in:

- 6.1. Interface NavigationEvent

https://w3c.github.io/uievents/#event-target Referenced in:

- 6.2.1. navbeforefocus
- 6.2.2. navnotarget (2)

https://www.w3.org/TR/uievents/#dom-keyboardevent-key Referenced in:

- 6.2.1. navbeforefocus

https://w3c.github.io/uievents/#keydown Referenced in:

- 4. Triggering Spatial Navigation

https://heycam.github.io/webidl/#idl-DOMString Referenced in:

- 6.1. Interface NavigationEvent

https://heycam.github.io/webidl/#Exposed Referenced in:

- 6.1. Interface NavigationEvent

### Terms defined by reference

- [css-break-4] defines the following terms:
  - box fragment
- [css-cascade-4] defines the following terms:
  - all
- [css-display-3] defines the following terms:
  - box
  - principal box
- [CSS-OVERFLOW-3] defines the following terms:
  - hidden
  - overflow-x
  - overflow-y
  - scroll container
  - scrollport
- [css-position-3] defines the following terms:
  - relative position
- [CSS-SCROLL-SNAP-1] defines the following terms:
  - mandatory
  - optimal viewing region
- [css-values-4] defines the following terms:
  - +
  - |
- [CSS2] defines the following terms:
  - border box
  - painting order
- [CSSOM-VIEW-1] defines the following terms:
  - scroll an element
- [DOM] defines the following terms:
  - Element
  - Event
  - EventTarget
  - Node
  - canceled flag
  - document
  - document element
  - node
  - node document
  - preventDefault()
  - target
- [feature-policy] defines the following terms:
  - default allowlist
  - policy-controlled feature
- [HTML] defines the following terms:
  - Window
  - active document
  - actually disabled
  - being rendered
  - browsing context
  - browsing context container
  - currently focused area of a top-level browsing context
  - dom anchor
  - expressly inert
  - focus()
  - focusable area
  - focusing steps
  - nested browsing context
  - origin
  - removed
  - sequential focus navigation order
  - sequential focus navigation starting point
  - tabindex
  - the body element
  - top-level browsing context
- [infra] defines the following terms:
  - assert
  - empty
  - remove
  - set
- [overscroll-behavior] defines the following terms:
  - scroll boundary
- [uievents] defines the following terms:
  - KeyboardEvent
  - UIEvent
  - UIEventInit
  - event target
  - key
  - keydown
- [WebIDL] defines the following terms:
  - DOMString
  - Exposed

## References

### Normative References

[CSS-BREAK-4]
  Rossen Atanassov; Elika Etemad. CSS Fragmentation Module Level 4. 18 December 2018. WD. URL: https://www.w3.org/TR/css-break-4/
[CSS-CASCADE-4]
  Elika Etemad; Tab Atkins Jr.. CSS Cascading and Inheritance Level 4. 28 August 2018. CR. URL: https://www.w3.org/TR/css-cascade-4/
[CSS-DISPLAY-3]
  Tab Atkins Jr.; Elika Etemad. CSS Display Module Level 3. 28 August 2018. CR. URL: https://www.w3.org/TR/css-display-3/
[CSS-OVERFLOW-3]
  David Baron; Elika Etemad; Florian Rivoal. CSS Overflow Module Level 3. 31 July 2018. WD. URL: https://www.w3.org/TR/css-overflow-3/
[CSS-POSITION-3]
  Rossen Atanassov; Arron Eicholz. CSS Positioned Layout Module Level 3. 17 May 2016. WD. URL: https://www.w3.org/TR/css-position-3/
[CSS-SCROLL-SNAP-1]
  Matt Rakow; et al. CSS Scroll Snap Module Level 1. 19 March 2019. CR. URL: https://www.w3.org/TR/css-scroll-snap-1/
[CSS-VALUES-4]
  Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 4. 31 January 2019. WD. URL: https://www.w3.org/TR/css-values-4/
[CSS2]
  Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. REC. URL: https://www.w3.org/TR/CSS2/
[CSSOM-VIEW-1]
  Simon Pieters. CSSOM View Module. 17 March 2016. WD. URL: https://www.w3.org/TR/cssom-view-1/
[DOM]
  Anne van Kesteren. DOM Standard. Living Standard. URL: https://dom.spec.whatwg.org/
[FEATURE-POLICY]
  Ian Clelland. Feature Policy. 16 April 2019. WD. URL: https://www.w3.org/TR/feature-policy-1/
[HTML]
  Anne van Kesteren; et al. HTML Standard. Living Standard. URL: https://html.spec.whatwg.org/multipage/
[INFRA]
  Anne van Kesteren; Domenic Denicola. Infra Standard. Living Standard. URL: https://infra.spec.whatwg.org/
[RFC2119]
  S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
[UIEVENTS]
  Gary Kacmarcik; Travis Leithead; Doug Schepers. UI Events. 30 May 2019. WD. URL: https://www.w3.org/TR/uievents/
[WebIDL]
  Boris Zbarsky. Web IDL. 15 December 2016. ED. URL: https://heycam.github.io/webidl/

### Informative References

[CSS-TRANSFORMS-1]
  Simon Fraser; et al. CSS Transforms Module Level 1. 14 February 2019. CR. URL: https://www.w3.org/TR/css-transforms-1/
[EXTENSIBLE]
  The Extensible Web Manifesto. 10 June 2013. URL: https://extensiblewebmanifesto.org/

## Property Index

Name | Value | Initial | Applies to | Inh. | %ages | Animation type | Canonical order | Computed value
--- | --- | --- | --- | --- | --- | --- | --- | ---
spatial-navigation-action | auto | focus | scroll | auto | scroll containers | no | n/a | discrete | per grammar | as specified
spatial-navigation-contain | auto | contain | auto | all elements | no | n/a | discrete | per grammar | as specified
spatial-navigation-function | normal | grid | normal | spatial navigation containers | no | n/a | discrete | per grammar | as specified

## IDL Index

    enum SpatialNavigationDirection {
        "up",
        "down",
        "left",
        "right",
    };

    partial interface Window {
        void navigate(SpatialNavigationDirection dir);
    };

    enum FocusableAreaSearchMode {
        "visible",
        "all"
    };

    dictionary FocusableAreasOption {
        FocusableAreaSearchMode mode;
    };

    dictionary SpatialNavigationSearchOptions {
        sequence<Node>? candidates;
        Node? container;
    };

    partial interface Element {
        Node getSpatialNavigationContainer();
        sequence<Node> focusableAreas(optional FocusableAreasOption option);
        Node? spatialNavigationSearch(SpatialNavigationDirection dir, optional SpatialNavigationSearchOptions options);
    };

    [Exposed=Window]
    interface NavigationEvent : UIEvent {
        constructor(DOMString type,
                    optional NavigationEventInit eventInitDict);
        readonly attribute SpatialNavigationDirection dir;
        readonly attribute EventTarget? relatedTarget;
    };

    dictionary NavigationEventInit : UIEventInit {
        SpatialNavigationDirection dir;
        EventTarget? relatedTarget = null;
    };

## Issues Index

The name of this API is under discussion <https://github.com/w3c/csswg-drafts/issues/3387> ↵
CSS should have a term for “border box taking into account corner shaping properties like border-radius”. <https://github.com/w3c/csswg-drafts/issues/2324> ↵
Terminology like this should be in [CSSOM-VIEW-1], [CSS-OVERFLOW-3], [CSS-SCROLL-SNAP-1]. <https://github.com/w3c/csswg-drafts/issues/2322> ↵
[CSSOM-VIEW-1] should probably define how to perform a scroll in a given direction without an explicit position. Until then, we roll our own. <https://github.com/w3c/csswg-drafts/issues/2323> ↵
#spatial-navigation Referenced in:

- 1. Introduction (2) (3)

#at-risk Referenced in:

- 5.2. Low level APIs
- 9.1. Creating additional spatial navigation containers: the spatial-navigation-contain property
- 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property

#enumdef-spatialnavigationdirection Referenced in:

- 5.1. Triggering Navigation Programmatically
- 5.2. Low level APIs
- 6.1. Interface NavigationEvent (2)

#dom-spatialnavigationdirection-up Referenced in:

- 8.4. Focus Navigation Heuristics (2) (3) (4) (5) (6) (7)

#dom-spatialnavigationdirection-down Referenced in:

- 8.4. Focus Navigation Heuristics (2) (3) (4) (5) (6) (7)

#dom-spatialnavigationdirection-left Referenced in:

- 8.4. Focus Navigation Heuristics (2) (3) (4) (5) (6) (7)

#dom-spatialnavigationdirection-right Referenced in:

- 8.4. Focus Navigation Heuristics (2) (3) (4) (5) (6) (7)

#dom-window-navigate Referenced in:

- 5.1. Triggering Navigation Programmatically (2)

#enumdef-focusableareasearchmode Referenced in:

- 5.2. Low level APIs

#dictdef-focusableareasoption Referenced in:

- 5.2. Low level APIs

#dom-focusableareasoption-mode Referenced in:

- 5.2. Low level APIs

#dictdef-spatialnavigationsearchoptions Referenced in:

- 5.2. Low level APIs
- Changes

#dom-spatialnavigationsearchoptions-candidates Referenced in:

- 5.2. Low level APIs

#dom-spatialnavigationsearchoptions-container Referenced in:

- 5.2. Low level APIs

#dom-element-spatialnavigationsearch Referenced in:

- Changes

#dom-element-getspatialnavigationcontainer Referenced in:

- 5.2. Low level APIs (2) (3)
- Changes

#dom-element-focusableareas Referenced in:

- 5.2. Low level APIs (2) (3)

#navigationevent Referenced in:

- 4. Triggering Spatial Navigation
- 6.1. Interface NavigationEvent (2) (3)
- 6.2.1. navbeforefocus (2) (3)
- 6.2.2. navnotarget (2) (3)

#dom-navigationevent-dir Referenced in:

- 6.2.1. navbeforefocus
- 6.2.2. navnotarget

#dom-navigationevent-relatedtarget Referenced in:

- 6.2.1. navbeforefocus (2)
- 6.2.2. navnotarget (2)

#dictdef-navigationeventinit Referenced in:

- 6.1. Interface NavigationEvent (2)

#eventdef-navigationevent-navbeforefocus Referenced in:

- 6.2.1. navbeforefocus

#dispatches-navbeforefocus-event Referenced in:

- 8.3. Navigation (2)

#eventdef-navigationevent-navnotarget Referenced in:

- 6.2.2. navnotarget
- 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property

#dispatches-navnotarget-event Referenced in:

- 8.3. Navigation

#navigation-override Referenced in:

- 6.2.1. navbeforefocus
- 6.2.2. navnotarget
- 7. The navigation-override policy-controlled feature (2) (3)

#boundary-box Referenced in:

- 8.1. Glossary
- 8.4. Focus Navigation Heuristics (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15) (16) (17)

#inside-area Referenced in:

- 8.1. Glossary
- 8.4. Focus Navigation Heuristics (2) (3) (4) (5) (6) (7)

#search-origin Referenced in:

- 8.4. Focus Navigation Heuristics (2)

#spatial-navigation-starting-point Referenced in:

- 8.1. Glossary
- 8.4. Focus Navigation Heuristics

#spatial-navigation-containers Referenced in:

- 3. Overview (2) (3) (4) (5) (6) (7) (8)
- 5.2. Low level APIs (2) (3) (4) (5) (6) (7) (8) (9)
- 6.2.2. navnotarget (2) (3) (4) (5) (6) (7)
- 8.2. Groupings of elements (2)
- 8.3. Navigation (2) (3)
- 8.4. Focus Navigation Heuristics
- 9.1. Creating additional spatial navigation containers: the spatial-navigation-contain property (2) (3)
- 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property
- 9.3. Selecting the navigation algorithm: the spatial-navigation-function property (2)
- Changes (2)

#spatial-navigation-steps Referenced in:

- 4. Triggering Spatial Navigation (2) (3)
- 5.1. Triggering Navigation Programmatically

#set-the-search-origin Referenced in:

- 8.3. Navigation

#update-the-search-origin Referenced in:

- 8.4. Focus Navigation Heuristics
- Changes

#find-focusable-areas Referenced in:

- 5.2. Low level APIs (2)
- 8.3. Navigation (2)
- 8.4. Focus Navigation Heuristics

#select-the-best-candidate Referenced in:

- 5.2. Low level APIs
- 6.2.1. navbeforefocus
- 8.3. Navigation (2)

#find-the-shortest-distance Referenced in:

- 8.4. Focus Navigation Heuristics
- 9.3. Selecting the navigation algorithm: the spatial-navigation-function property

#propdef-spatial-navigation-contain Referenced in:

- 3. Overview
- 8.2. Groupings of elements
- 9.1. Creating additional spatial navigation containers: the spatial-navigation-contain property (2)

#propdef-spatial-navigation-action Referenced in:

- 8.3. Navigation (2) (3) (4) (5) (6)
- 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property (2) (3) (4)

#valdef-spatial-navigation-action-auto Referenced in:

- 8.3. Navigation
- 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property

#valdef-spatial-navigation-action-focus Referenced in:

- 8.3. Navigation (2) (3) (4)
- 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property (2)

#valdef-spatial-navigation-action-scroll Referenced in:

- 8.3. Navigation

#propdef-spatial-navigation-function Referenced in:

- 9.3. Selecting the navigation algorithm: the spatial-navigation-function property
- Changes

#can-be-manually-scrolled Referenced in:

- 8.3. Navigation (2) (3)

#directionally-scroll-an-element Referenced in:

- 8.3. Navigation (2) (3)
- 9.2. Controlling the interaction with scrolling: the spatial-navigation-action property