Closed Bug 1519090 Opened 5 years ago Closed 5 years ago

keyboard focus is trapped inside <slot>

Categories

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

64 Branch
Desktop
All
defect

Tracking

()

VERIFIED FIXED
mozilla66
Tracking Status
firefox64 --- wontfix
firefox65 --- wontfix
firefox66 --- verified

People

(Reporter: cronon12, Assigned: edgar)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 OPR/57.0.3098.106

Steps to reproduce:

Version: 64.0
Build ID: 20181207224003
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0

  1. Open https://codepen.io/anon/pen/XoPORj
  2. Click on white space
  3. Press tab key few times

Actual results:

Focus starts moving only between buttons inside the <slot> tag.

Expected results:

Focus should go through both "inside" and "outside" buttons

This issue occurs as described on Windows, Mac OS and Ubuntu on all three main versions of Firefox.
Component chosen is Keyboard Navigation.
Thank you for your contribution!

Status: UNCONFIRMED → NEW
Component: Untriaged → Keyboard Navigation
Ever confirmed: true
OS: Unspecified → All
Hardware: Unspecified → Desktop
Component: Keyboard Navigation → Event Handling
Product: Firefox → Core

It looks like we don't handle focus navigation with unassigned slot well.

Assignee: nobody → echen
Blocks: shadowdom
Component: Event Handling → DOM
Priority: -- → P2

(In reply to cronon12 from comment #0)

Focus starts moving only between buttons inside the <slot> tag.

It is because the FindOwner [1] call of "inside" button returns <slot>, and then GetNextTabbableContentInAncestorScopes redirects startContent to <slot> given that it could not find next tabbable content, then the following frame/tree traversa [3]l starts from <slot> and stop at the first "inside" button again.

The owner of "inside" button should not be the <slot> and we should not run GetNextTabbableContentInAncestorScopes either since there is no shadow dom involved at all...

[1] https://searchfox.org/mozilla-central/rev/b29663c6c9c61b0bf29e8add490cbd6bad293a67/dom/base/nsFocusManager.cpp#2952
[2] https://searchfox.org/mozilla-central/rev/b29663c6c9c61b0bf29e8add490cbd6bad293a67/dom/base/nsFocusManager.cpp#3211
[3] https://searchfox.org/mozilla-central/rev/b29663c6c9c61b0bf29e8add490cbd6bad293a67/dom/base/nsFocusManager.cpp#3233-3267

(In reply to Edgar Chen [:edgar] from comment #3)

The owner of "inside" button should not be the <slot> and we should not run GetNextTabbableContentInAncestorScopes either since there is no shadow dom involved at all...

I was wrong, per spec, slot element is a also a scope owner even if it is not in shadow dom or has no assigned nods. So the issue here is that in some cases we only check shadow host, but we should also check slot as well.

The nodes under slot scope is already being traversed in
GetNextTabbableContentIn*Scope.
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/12ffc4e92ff6
Part 1: Some minor nsFocusManager cleanup; r=smaug
https://hg.mozilla.org/integration/autoland/rev/48f01f2f5573
Part 2: Skip the node under slot scope in frame traversal; r=smaug
https://hg.mozilla.org/integration/autoland/rev/4e227c741b4b
Part 3: nsFocusManager::GetNextTabbableContentInScope should also check slot if aSkipOwner is false; r=smaug
https://hg.mozilla.org/projects/cedar/rev/12ffc4e92ff6a552e36d5367abe11f79f458bdb8
Bug 1519090 - Part 1: Some minor nsFocusManager cleanup; r=smaug

https://hg.mozilla.org/projects/cedar/rev/48f01f2f5573921e1f02617ebc9c5426eaef9973
Bug 1519090 - Part 2: Skip the node under slot scope in frame traversal; r=smaug

https://hg.mozilla.org/projects/cedar/rev/4e227c741b4bb4ebb15d869a02acb83c1a656a54
Bug 1519090 - Part 3: nsFocusManager::GetNextTabbableContentInScope should also check slot if aSkipOwner is false; r=smaug

This issue is now verified in Nightly v66.0a1 from 2019-01-23 on Windows 10, Ubuntu 16 and Mac OS 10.14.2.

Thanks!

Status: RESOLVED → VERIFIED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: