Skip to content

Commit 7ac0343

Browse files
author
Jihye Hong
authored
Add the proposal spatialnavigation feature policy
1 parent 83e93f7 commit 7ac0343

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

explainer.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,30 @@ if (document.body.spatialNavigationSearch) {
358358
The iframe element needs to be consider carefully for moving the focus.
359359
Using the Feature Policy API can be the solution.
360360

361-
In detail, by default the focus cannot move inside the iframe element.
362-
But for the iframe with the spatial navigation feature is allowed via the Feature Policy API,
363-
the focus will move inside it.
361+
By default the focus can move to the iframe element which are the same-origin.
362+
But for the iframe with `spatialnavigation` value is given to `allow` attribute (Feature Policy API), the focus can move inside it.
364363

365-
For example, the case below, the focus can move inside via the spatial navigation.
364+
In detail, the approach for the Feature policy would be like below:
365+
366+
Default policy: spatialnavigation 'self'
367+
368+
A page can declare the spatial navigation feature in its HTTP headers as follows:
369+
```
370+
Feature policy: spatialnavigation 'self'
366371
```
367-
<iframe src="https://example.com..." allow="spatialnavigation *"></iframe>
372+
It means that only same-origin iframe elements are allowed for the spatial navigation.
373+
374+
Also, the feature can be specified for a single iframe element using `allow` attribute as below:
375+
```
376+
<iframe src="https://example.com..." allow="spatialnavigation 'none'"></iframe>
368377
```
378+
This will block the spatial navigation feature for the corresponding iframe element.
379+
380+
For example, the spatial navigation feature is allowed when the feature policy is specified as below:
381+
![<img>featurepolicy-example](https://github.com/jihyerish/jihyerish.github.io/blob/master/img/featurepolicy.png)
382+
- Default policy: sptialnavigation 'self'
383+
- example.com: Feature-Policy: spatialnavigation https://game.com
384+
- game.com: <iframe src=“game.com" allow=“spatialnavigation https://www.good-ad.com"></iframe>
369385

370386
### How can the spatial navigation works for the HTMLFormElement?
371387

0 commit comments

Comments
 (0)