Closed Bug 1981724 Opened 9 months ago Closed 9 months ago

Elements inside `::details-content` cannot be focussed with tab

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: keithamus, Assigned: keithamus)

References

Details

Attachments

(1 file)

Given

<!DOCTYPE html>
<details>
  <summary>First</summary>
  <p>Then <a href=https://mozilla.org>Second</a></p>
</details>
Finally <button>Third</button>

Running with the pref disabled:

  1. Open page
  2. Click "First"
  3. Press tab
  4. Observe "Second" is focussed
  5. Press tab
  6. Observe "Third" is focussed

Running with pref enabled:

  1. Open page
  2. Click "First"
  3. Press tab
  4. Observe "Third" is focussed

In GetNextTabbableContentInScope we iterate over content, trying to find
the next tabbable content within the scope. With the next peice of
iterable content we first check if it is IsInNativeAnonymousSubtree and
if it has a PrimaryFrame, and if so check that frames tabIndex. If the
element does not have a frame we then check the host/slot tabindex.
Finally if it's not a host/slot we check the primary frame (again).

This means for slots with a display:contents value, they'll have no
frame and they'll drop to the next condition (IsHostIsSlot), however
for slots with a frame (e.g. display:block) they'll use the frames
tabIndex value.

For a slot element with display:block this means we're reliant on the
primary frame's focusability, but this is an incorrect flow of logic
because it means that the slot with display:block is skipped - one such
element exists: the ::details-content pseudo.

By simply removing this check, and letting the else block resolve the
primary frame's tabIndex, we can correctly ensure ::detils-content
children can be focused.

Pushed by dholbert@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c12f6043526d https://hg.mozilla.org/integration/autoland/rev/ac7effcd1954 Ensure avoid checking PrimaryFrame before IsHostIsSlot for next tabbable r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/54216 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch
Upstream PR merged by moz-wptsync-bot
Upstream PR merged by moz-wptsync-bot
QA Whiteboard: [qa-triage-done-c144/b143]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: