Open Bug 1233594 Opened 9 years ago Updated 2 years ago

Shadow DOM has surprising, frustrating text selection behavior

Categories

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

defect

Tracking

()

People

(Reporter: abr, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached file Example of issue
Text section interaction with shadow DOM has some rather surprising and frustrating behavior.

STR:
1) Open the attached example in Firefox
2) Attempt to some subset of the text; for example, "This]]] [[[is"
3) Open the same example in Chrome
4) Repeat the attempt

From a user perspective, I think Chrome's behavior is what is expected here.
You're aware that shadow DOM spec has changed, and <content> element for example is gone?

Anyhow, selection in shadow dom is unspecified. Definitely something to fix in spec level, at least
as much it is possible given that browsers implement selection in rather different ways.
Want to file a spec bug?
(In reply to Olli Pettay [:smaug] from comment #1)
> You're aware that shadow DOM spec has changed, and <content> element for
> example is gone?

Thanks for the heads-up. I'll wait for our new implementation to land, and re-test. If we re-use the same code (i.e., swap out <content> handling for <slot> handling), I would expect this flaw to remain.

> Anyhow, selection in shadow dom is unspecified. Definitely something to fix
> in spec level, at least
> as much it is possible given that browsers implement selection in rather
> different ways.

Sure. I don't think this is a spec issue, I think it is an obvious usability flaw. I contrast with Chrome as a demonstration of what I think constitutes usable behavior.

> Want to file a spec bug?

Text selection seems to be more of a UI issue than a spec issue. I think the criteria here is "UI shouldn't hurt," not "spec compliance."
(In reply to Adam Roach [:abr] from comment #2)
> Sure. I don't think this is a spec issue,
Of course it is. If something is not spec'ed properly, it is close to impossible to implement APIs in compatible manner.

> Text selection seems to be more of a UI issue than a spec issue. I think the
> criteria here is "UI shouldn't hurt," not "spec compliance."
It is partially UX issue, partially spec issue.
Note, in Chrome window.getSelection().toString() gives very odd results here when comparing to the string which is actually selected.
But clearly FF's behavior here is far from optimal.
Priority: -- → P5
Selection crossing shadow DOM is still problematic even shadow DOM spec is V1 now. I agree that this is a spec level issue, may I know if there is a spec bug I could follow?
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: