[wpt-sync] Sync PR 43244 - Add Test for text selection when Shadow Root has delegatesFocus enabled
Categories
(Core :: DOM: Core & HTML, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox124 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 43244 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/43244
Details from upstream follow.
Jesse Jurman <j.r.jurman@gmail.com> wrote:
Add Test for text selection when Shadow Root has delegatesFocus enabled
I recently discovered that text selection has inconsistent behavior across browsers when
delegatesFocusis enabled for shadow DOM.The behavior appears at the moment to be:
- On Chromium browser (specifically Chrome and Edge), text selection of a non-focusable element (like
<span>) does not work if another element in the shadow-root could retrieve focus (like a<button>).- On other browsers, like Firefox and Safari, text can be selected and works as it might if the content had been written in the light DOM.
Here's a codepen with two shadow roots, one with
delegatesFocusistrue, and one wheredelegatesFocusisfalse- it has mostly similar content to the test being proposed here: https://codepen.io/JRJurman/pen/gOqvxXzIt's actually not totally obvious what the expected behavior here is, given the description on mdn: https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/delegatesFocus
If true, when a non-focusable part of the shadow DOM is clicked, or .focus() is called on the host element, the first focusable part is given focus, and the shadow host is given any available :focus styling.
I believe the expected behavior here is the implementation found in Firefox and Safari, where text-selection still works as expected.
This has also been documented in the past on stack overflow (however these posts were dismissed by the authors because the feature was experimental at the time).
| Assignee | ||
Updated•2 years ago
|
| Assignee | ||
Comment 1•2 years ago
|
||
| Assignee | ||
Comment 2•2 years ago
|
||
CI Results
Ran 6 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI
Total 1 tests and 2 subtests
Status Summary
Firefox
OK : 1
PASS: 2
Chrome
OK : 1
PASS: 1
FAIL: 1
Safari
OK : 1
PASS: 2
Links
Comment 4•2 years ago
|
||
| bugherder | ||
Description
•