-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Description
I'd like to propose a focus area for Interop 2023 focused on session history and navigation between URLs. This would include:
-
Foundational interoperability work on things like: what happens when navigating (especially in edge cases); how iframes impact the session history; when load/hashchange/popstate/etc. events fire; the sync vs. async nature of history traversals; what happens if code tries to go back and then forward and then navigate; how well about:/data:/blob: URLs work for navigation; scroll restoration; fragment navigation; etc.
-
The existing navigation and history APIs, i.e.
window.locationandwindow.history. -
The new navigation API, which provides a much cleaner model for history and navigation. (This spec is currently in the WICG, but will be merged into the HTML Standard in October.)
Rationale
These areas are historically a large pain for web developers. @tbondwilkinson wrote up a vivid example; you can also see the HTML Standard's list of issues tagged "interop" and either "topic: navigation" or "topic: session history". This pain often spills over into broken behavior for users, e.g. pages not loading, the back button not working, scrolling being broken, or even jQuery's file upload code failing due to interaction with javascript: URL iframes. I suspect implementers who have worked in this area, and been on the frontlines of relevant bug triage, know how thorny an area this is (cc @annevk, @hsivonen, @smaug----, @natechapin). Getting interop on the foundations and existing APIs, and encouraging implementation of the new navigation API, will solve a lot of developer pain.
For some aggregate signals, for the navigation API we have many upvotes on the original WICG proposal (the second-most of any WICG proposal to date). For general history and navigation, we have use counters such as ~30% of pages using history.replaceState(), ~20% of pages using sandboxed iframes, or of course the fact that 100% of page loads happen via navigation :).
Now is a good time to work on this project. On the specification side, within the month of October we plan to land whatwg/html#6315, which will resolve ~45 known spec issues with a definitive, principled behavior based on a coherent model. As part of that, and in the month or so after landing, we'll be increasing the test coverage for navigation and history, ensuring that all existing tests match the updated spec. Additionally, once that PR is landed, we're planning to move the navigation API spec out of WICG and into the HTML Standard. The navigation API move will also happen in October.
Specification
The following sections of the HTML Standard:
- "Loading web pages" excluding "Security infrastructure for Window, WindowProxy, and Location objects", "The WindowProxy exotic object", "Origin-keyed agent clusters", "Cross-origin opener policies", "Cross-origin embedder policies" (upcoming rewrite version has the same scope)
- All contents of https://wicg.github.io/navigation-api/, which will be part of HTML's "Loading web pages" section in October.
- "The
iframeelement" - "The
aelement" - "The
baseelement" - "Links" excepting the "Link types" subsection
Optional parts of the standard, which fit with the theme but I would be happy to remove from the proposal if reviewers would prefer that:
- "The
embedelement" and "Theobjectelement": similar to iframes, but less used and more legacy, and their spec is more of a mess because of it. - The OKAC, COOP, and COEP sections of "Loading web pages": these are new-ish headers, mostly focused around security. I think getting interop on them is good, but I don't see a lot of evidence of developer pain based on these headers' current interop status, so we could omit them.
- The Window/WindowProxy/Location sections of Loading web pages: these sections are really about the subtleties of JavaScript bindings, and not really about history or navigation. Again, interop is good, but the existing interop bugs about these sections are not known to be a huge source of developer pain. (Note that the interop issue of WindowProxy reuse (Rationalize behavior of Window object reuse whatwg/html#3267) is in a different section, and so is included.)
Tests
-
html/browsers/, excludingorigin/origin-keyed-agent-clusters/,the-windowproxy-exotic-object/, and a few of the tests inthe-window-object/if we don't do the optional components for them -
html/semantics/linksexcluding thelinktypes/subdirectory -
navigation-api/(this will be moved intohtml/browsers/in ~October)
Optional (corresponding to the above optional spec sections):
Note that as part of the spec work mentioned above, over the rest of 2022 we plan to (a) add more coverage to html/browsers/; (b) aspirationally, do a general reorganization and renaming of existing tests of the html/browsers/ directory, since they are some of the oldest tests and thus often their paths don't make any sense or they have useless filenames like 006.html or traverse_the_history_5.html. This should help ensure we're starting from a good baseline, e.g. by fixing any failing-in-all-browsers tests before 2023 starts.
Important note: wpt.fyi is especially fragile for these sorts of tests, often giving incorrect failures. (I.e., failures that don't match what a user sees by loading the corresponding test in the browser on wpt.live.) See, e.g., web-platform-tests/wpt#33590 and web-platform-tests/wpt#23364 . Fixing this would probably need to be a priority for the wpt.fyi infrastructure team, to make this project feasible.