Closed Bug 1512457 Opened 6 years ago Closed 6 years ago

Fix various cases that focus navigation doesn't work well with frameless shadow host

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: edgar, Assigned: edgar)

References

(Blocks 1 open bug)

Details

Attachments

(6 files, 1 obsolete file)

No description provided.
Blocks: shadowdom
(I wouldn't be very surprised if display: contents; causes issues in focus handling even without Shadow DOM.)
Attached file test.html (obsolete) (deleted) —
If you append elements after host, then it works well. It looks like we do not handle some corner case well.
Priority: -- → P2
Attached file test_bug1512457.html (deleted) —
Something wrong in the test case, upload a correct version.
Attachment #9029830 - Attachment is obsolete: true
(In reply to Edgar Chen [:edgar] from comment #3) > Created attachment 9030665 [details] > test_bug1512457.html It is caused by light DOM traversing in https://searchfox.org/mozilla-central/rev/fd32b3a6fa3eff1468311f6fcf32b45c117136df/dom/base/nsFocusManager.cpp#3232-3248, in this case, we redirect iterStartContent to aRootContent, and start search from aRootContent again, but we should move focus to the urlbar, like https://searchfox.org/mozilla-central/rev/fd32b3a6fa3eff1468311f6fcf32b45c117136df/dom/base/nsFocusManager.cpp#3492-3506 did. And I found another issue, light DOM traversing would skip the element that have no frame, however it could be a shadow host with "display: contents", we should check the shadow tree scope instead.
Attached file test_bug1512457_2.html (deleted) —
(In reply to Edgar Chen [:edgar] from comment #5) > And I found another issue, light DOM traversing would skip the element that > have no frame, however it could be a shadow host with "display: contents", > we should check the shadow tree scope instead. Attach test case for this. (focus doesn't move to 'shadowinput2' when focus is on 'shadowinput1' and press Tab)
(In reply to Edgar Chen [:edgar] from comment #6) > Created attachment 9031368 [details] > test_bug1512457_2.html Found another issue: when focus is on 'shadowinput1' or 'shadowinput1' and then press Shift+Tab, focus doesn't move.
Summary: Tab does not take focus out from Shadow DOM if the host is the last element and "display: contents" → Fix various cases that focus navigation doesn't work well with frameless shadow host
In this case we should look for next highest tabindex or do end searching handling, instead of just check the root content.
Attachment #9032178 - Attachment description: Bug 1512457 - Part 3: Ensure GetNextTabbableContentInScope returns a focusable content at frame level; → Bug 1512457 - Part 3: Ensure GetNextTabbableContentInScope returns only elements which have a frame;
Pushed by echen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/132b45eb718f Part 1: Correctly handle the case that FocusManager could not find next content has frame in tree; r=smaug https://hg.mozilla.org/integration/autoland/rev/243f3dd33bfb Part 2: Enter into frameless shadow host scope during tree traversal; r=smaug https://hg.mozilla.org/integration/autoland/rev/ebeac4ea403b Part 3: Ensure GetNextTabbableContentInScope returns only elements which have a frame; r=smaug https://hg.mozilla.org/integration/autoland/rev/84b78ae21626 Part 4: Add more tests for frameless shadow host; r=smaug
Type: enhancement → defect
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: