Closed Bug 1455893 Opened 7 years ago Closed 20 days ago

Cannot select elements across shadow boundaries.

Categories

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

defect

Tracking

()

RESOLVED FIXED
132 Branch
Tracking Status
firefox132 --- fixed

People

(Reporter: emilio, Assigned: sefeng)

References

(Depends on 3 open bugs, Blocks 3 open bugs)

Details

Attachments

(2 files)

STR: * Go to https://wpt.fyi/css/cssom/interfaces.html * Try selecting content from the warning message that says: > Data below are intended for web platform implementers and do not contain useful metrics for evaluation or comparison of web platform features. Also note that tested Edge and Safari are not pre-release versions (#109, #110). and moving it into the results table. Expected: * I can select text across shadow DOM boundaries. Actual: * The selection is chomped to the table contents inside the Shadow Root.
Component: Audio/Video: Playback → DOM
Depends on: 1455894
This is a spec issue too. As far as I know, Gecko works like Webkit, since that is per current spec.
Priority: -- → P3
Component: DOM → DOM: Core & HTML
See Also: → 1741051

I am going to spend some time in the shadow dom cross boundary selecton proposal and see what we can do.

Assignee: nobody → sefeng

Looks like STR is outdated, so I attached a new testcase.

Severity: normal → S3
Duplicate of this bug: 1843725

Is this still being worked on? Otherwise consider unassigning it.

Yeah, I am working on this

Flags: needinfo?(sefeng)

Any gut feeling yet how complex fixing this is? Any context here is appreciated.

Flags: needinfo?(sefeng)

Implementing the spec to return the ranges that have the correct start and end nodes is easy, though making the actual selection work (ie. the blue selection background) is hard.

Mostly due the selection code has the assumption that no shadow DOM is involved. For example ContentIterator doesn't iterate elements in shadow DOM, range gets confused for its common ancestor. Lots of assertions had the same assumption so it's hard to fix them. Slotted contents makes the entire thing more complicated.

Plus the same code has been used not only by selection but also editor stuff, which adds another level of complexity.

So far I've implemented the spec and made the visual selection works for some fairly complex shadow trees. I am fixing test failures related to editor and slotted contents. Fixed lots of them already, but still have a decent number of failures to go.

Hope this provides some context :)

Flags: needinfo?(sefeng)

Hope this provides some context :)

It did, thanks.

Btw., be aware that the clipboard-code might need refinement too.

Blocks: 1860292
Depends on: 1867058
Depends on: 1867059
Depends on: 1867060
Depends on: 1867145
Attachment #9423957 - Attachment description: WIP: Bug 1455893 - Fix a bug where incorrect frame is used → Bug 1455893 - Fix a bug where incorrect frame is used for shadow-crossing selection r=smaug
Pushed by sefeng@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e37dd09ed484 Fix a bug where incorrect frame is used for shadow-crossing selection r=smaug
Status: NEW → RESOLVED
Closed: 20 days ago
Resolution: --- → FIXED
Target Milestone: --- → 132 Branch
Duplicate of this bug: 1741051
Duplicate of this bug: 1730723
Duplicate of this bug: 1671377
Duplicate of this bug: 1563704
Duplicate of this bug: 1545367
Duplicate of this bug: 1233594
Duplicate of this bug: 1223203
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: