Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation API #34

Closed
robwormald opened this issue Jul 12, 2022 · 8 comments
Closed

Navigation API #34

robwormald opened this issue Jul 12, 2022 · 8 comments
Assignees
Labels
from: Google Proposed, edited, or co-edited by Google. position: support topic: html Spec relates to HTML (Hypertext Markup Language) topic: loading venue: WHATWG HTML Workstream venue: WICG Proposal is incubated in the Web Incubator Community Group

Comments

@robwormald
Copy link

robwormald commented Jul 12, 2022

Request for position on an emerging web specification

  • WebKittens who can provide input:

Information about the spec

Design reviews and vendor positions

Bugs tracking this feature

  • WebKit Bugzilla:
  • Radar:

Anything else we need to know

Linked explainers explain it well.

From a developer point of view this is a massive leap forward over the existing, kludgy solutions for routing / navigation interception. This is a difficult API to polyfill correctly, but a positive signal from WebKit would allow us to at least know there's a better future on the way.

From a framework implementer point of view, the biggest win with this API would allow us to properly centralize route handling, and perhaps begin to share / reuse more framework agnostic routing mechanisms. Most frameworks today must intercept anchor click events and effectively spoof navigation behavior, and this behavior is generally not compatible across various implementations, and requires a fair bit of (often brittle) code.

Angular : https://github.com/angular/angular/blob/main/packages/router/src/directives/router_link.ts#L396-L415
Vue: https://github.com/vuejs/router/blob/main/packages/router/src/RouterLink.ts#L138-L301
Remix: https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/index.tsx#L270-L301

@othermaciej othermaciej added venue: WICG Proposal is incubated in the Web Incubator Community Group labels Jul 15, 2022
@domenic
Copy link

domenic commented Jul 27, 2022

FYI the plan is to merge this into HTML; given Mozilla's support that work is mostly blocked on finishing whatwg/html#6315 first.

@annevk annevk added topic: html Spec relates to HTML (Hypertext Markup Language) topic: loading venue: WHATWG HTML Workstream labels Aug 24, 2022
@othermaciej othermaciej added the from: Google Proposed, edited, or co-edited by Google. label Sep 25, 2022
@bkardell
Copy link

bkardell commented Mar 15, 2023

It seems worth noting that whatwg/html#6315 mentioned by @domenic merged on Halloween 2022 and whatwg/html#8502 was created since and what to look at now?

@annevk
Copy link
Contributor

annevk commented Mar 15, 2023

Thank you for mentioning that @bkardell, that is indeed unclear. What we all need to review is whatwg/html#8502 which is rendered at https://whatpr.org/html/8502/nav-history-apis.html#navigation-api. (Both are linked from https://wicg.github.io/navigation-api/ but that was not linked from OP until I edited it just now.)

@domenic
Copy link

domenic commented Mar 23, 2023

Hi folks, is there anything else I can do to help get WebKit's position on this API? Apart from the lack of clarity on multi-implementer interest, the spec PR is about ready to land, having gone through a few rounds of review.

@rd3k
Copy link

rd3k commented May 22, 2023

Is this blocked on anything in particular or just queued?

@lukewarlow
Copy link
Member

https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigation-api The navigation API has been merged into the HTML spec just as an fyi.

@annevk
Copy link
Contributor

annevk commented Oct 4, 2023

Colleagues and I discussed this and as a result would like to mark this as "position: support" one week from now.

One unresolved question: why is it navigate(), but traverseTo()? Instead of navigateTo() & traverseTo() or navigate() & traverse().

@domenic
Copy link

domenic commented Oct 10, 2023

One unresolved question: why is it navigate(), but traverseTo()? Instead of navigateTo() & traverseTo() or navigate() & traverse().

We chose traverseTo() instead of traverse() to indicate that, unlike history.go(), it's specifically going to a target passed as the argument, instead of moving by an offset.

We honestly weren't comparing navigate() and traverseTo() with each other much, and I can see how it's a bit strange when you look at them side-by-side. I tend to split the API mentally though: back(), forward(), traverseTo() in one corner, and navigate() in another.

Maybe another way of looking at it is, navigate(x) and navigateTo(x) should mean the same thing, so we pick the shorter/simpler one. Whereas traverse(x) and traverseTo(x) could arguably mean different things.

I hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from: Google Proposed, edited, or co-edited by Google. position: support topic: html Spec relates to HTML (Hypertext Markup Language) topic: loading venue: WHATWG HTML Workstream venue: WICG Proposal is incubated in the Web Incubator Community Group
Development

No branches or pull requests

9 participants