8000 Focus restoration for same-document/fragment back-forward navigation · Issue #7397 · whatwg/html · GitHub
[go: up one dir, main page]

Skip to content

Focus restoration for same-document/fragment back-forward navigation #7397

@WestonThayer

Description

@WestonThayer

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0