Bug 233320 - Update shadow DOM and dialog element focusing to latest spec
Summary: Update shadow DOM and dialog element focusing to latest spec
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on: 233777
Blocks: dialog-element 148695
  Show dependency treegraph
 
Reported: 2021-11-18 10:17 PST by Domenic Denicola
Modified: 2022-03-07 05:35 PST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Domenic Denicola 2021-11-18 10:17:54 PST
The spec was previously not shadow DOM aware. In https://github.com/whatwg/html/pull/7285 we made it behave the same as delegatesFocus: they both "delegate focus" to either autofocus="" if it's specified on a (non-shadow-including) descendant, or the first focusable element among their shadow-including descendants if not.

Tests: https://github.com/web-platform-tests/wpt/pull/31523
Comment 1 Radar WebKit Bug Importer 2021-11-25 10:18:18 PST
<rdar://problem/85753180>
Comment 2 Domenic Denicola 2022-01-31 08:15:55 PST
After https://github.com/whatwg/html/pull/7361 and https://github.com/web-platform-tests/wpt/pull/31724 I believe this algorithm is now in good shape and implementable.
Comment 3 Jouni Koivuviita 2022-03-07 05:35:26 PST
I’m not entirely sure this is 100% related or worthy a new bug report, but there’s an issue in Safari Tech Preview 141, when the dialog and the content of the dialog are in different DOM "scopes" (light DOM vs shadow DOM).

The content is not focusable at all using the Tab key, and the dialog is not closed when clicking a button inside a <form method="dialog">.

Here’s a test case I created for the four different cases: https://jsbin.com/finugon/

- Dialog and content in light DOM (works)
- Dialog in light DOM, content in shadow DOM (broken)
- Dialog and content in shadow DOM (works)
- Dialog in shadow DOM, content in light DOM (slotted) (broken)