Open Bug 1743689 Opened 4 years ago Updated 4 years ago

Keyboard focus not restored for back fragment navigations

Categories

(Core :: DOM: UI Events & Focus Handling, enhancement)

Firefox 94
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: weston, Unassigned)

Details

Attachments

(1 file)

Attached file focus-restoration.html

Steps to reproduce:

  1. Open focus-restoration.html
  2. TAB to the "Section 3" link in the table of contents and press ENTER. Firefox navigates to the #sec3 fragment (added to history stack, page scrolls, sequential focus navigation starting point is at <h2 id="sec3">)
  3. Go back with ALT/CMD + RIGHT_ARROW

Actual results:

Focus and sequential focus navigation starting point remains where it was after step (2).

Expected results:

As a user, I'd expect focus to be restored to <a href="#sec3">Section 3</a> so I could continue to navigate the table of contents with my keyboard. The spec (https://html.spec.whatwg.org/multipage/browsing-the-web.html#scroll-to-fragid) suggests that focus should move to <body> and sequential focus navigation starting point should be reset to the top of the document.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: UI Events & Focus Handling' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: UI Events & Focus Handling
Product: Firefox → Core

I can see why this isn't great in principle, but do we need to keep it this way for interop?

Flags: needinfo?(annevk)

I'm not sure how much expectations websites have around back-forward navigation. Restoring the focused element seems like a reasonable idea, but it would only be possible to support this same-document and through bfcache. Weston, could you file an issue at https://github.com/whatwg/html/issues/new to see if we can get some cross-browser discussion going? Please also mention the bugs you filed there. Thanks!

Flags: needinfo?(annevk) → needinfo?(weston)
Flags: needinfo?(weston)

Anne: Could you set proper priority and severity?

Flags: needinfo?(annevk)
Type: defect → enhancement
Flags: needinfo?(annevk)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: