-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Now that Chromium, Firefox, and Safari all have bfcache support for cross-document navigation, focus is properly restored. For example, if you TAB to a link, navigate, then go back, TAB picks up where you left off (as opposed to restarting at the top of the document). This is also true for the sequential focus navigation starting point (SFNSP).
However the same is not true for fragment navigations within the same document (<a href="#some-id">) across all 3 browsers (although Chromium's behavior differs slightly from Firefox and Safari). Should it? As a keyboard user, I'd love for focus restoration to work the same way whether I'm navigating cross-document or same-document.
The current spec seems to have a slightly different opinion. I interpret https://html.spec.whatwg.org/multipage/browsing-the-web.html#scroll-to-fragid to mean that focus & SFNSP should be managed the same way regardless of whether you're navigating to a new URL, going backward, or going forward. To me this seems like a better UX than doing nothing (at least my focus will probably be somewhere close to where it was), but again, I'd like to have parity with cross-document navs.
Notes on different behaviors:
- Chromium does not update focus or SFNSP when navigating back or forward (https://bugs.chromium.org/p/chromium/issues/detail?id=1275230)
- There are some cases where it does, I don't entirely understand the behavior. See bug for details
- Firefox doesn't update focus or SFNSP when navigating back, but follows the spec going forward (https://bugzilla.mozilla.org/show_bug.cgi?id=1743689)
- Safari matches Firefox (https://bugs.webkit.org/show_bug.cgi?id=233654)