Skip to content

Commit 7e423b6

Browse files
committed
Add description of what window.navigate() is for
Closes #70
1 parent 26e9a69 commit 7e423b6

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

index.bs

+20-5
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,26 @@ JavaScript API</h2>
388388
<h3 id=high-level-api>
389389
Triggering Navigation Programmatically</h3>
390390

391-
Issue: This API is clearly useful for testing purposes.
392-
It may also be useful for authors,
393-
but the use cases are less strong.
394-
Maybe this should be moved to WebDriver and be a testing-only API.
395-
Maybe it is fine as is.
391+
The {{Window/navigate()}} method enables the author to trigger spatial navigation programatically,
392+
as if the user had done so manually
393+
(for instance, by pressing the arrow keys in a browser where that is the way to trigger spatial navigation).
394+
395+
Note: As this triggers the same processing model as a manual navigation,
396+
all the same results should be expected:
397+
the same chain of events will be fired and
398+
the same element will be scrolled or focused.
399+
400+
Note: Authors can use this to trigger spatial navigation
401+
based on a different UI mechanism than the one assigned by the UA,
402+
such as mapping to different keys,
403+
or triggering spatial navigation from a clickable on-screen directional pad.
404+
or in reaction to other events than UI ones.
405+
It could also be used when an author wants to interrupt navigation to do some asynchronous operation
406+
(e.g. load more content in an infinite scroller) then resume where they cancelled.
407+
408+
Note: This API is also useful for testing purposes,
409+
as there is no other way to trigger spatial navigation
410+
that does not depend on vendor specific UI conventions.
396411

397412
<pre class="idl">
398413
enum SpatialNavigationDirection {

0 commit comments

Comments
 (0)