Copying multiple lines from `<details>` causes everything in it to be copied
Categories
(Core :: DOM: Serializers, defect)
Tracking
()
People
(Reporter: dshin, Assigned: edgar)
References
(Blocks 1 open bug)
Details
(Keywords: webcompat:platform-bug)
User Story
user-impact-score:300
Attachments
(2 files)
Discovered this while trying to copy CSSWG resolution chat log. Confirmed via mozregression --launch 2025-10-16 -a summary.html
STR:
- Load attached testcase
- Select & copy a single line of A
- Paste it somewhere to verify its content
- Select & copy multiple lines of A
- Paste it somewhere to verify its content
Expected: Both Step 3 and 5 pastes what was selected visually
Actual: Step 5 pastes the content of the entire details element
Comment 1•7 months ago
|
||
This is pretty bad as far as how user-facing functionality is impaired, but considering that details isn't that common, it seems excessive to say S2. Saying S3.
| Assignee | ||
Updated•4 months ago
|
| Assignee | ||
Comment 2•4 months ago
•
|
||
<details> use the shadow tree, https://searchfox.org/firefox-main/rev/b67c6262ecbe7d4c9385a1bd335fd7dd1d3f887d/dom/html/HTMLDetailsElement.cpp#94, this is an issue of serializing a shadow DOM selection. The way we compute the flatten tree ancestors and offsets for serializing seems wrong, https://searchfox.org/firefox-main/rev/b67c6262ecbe7d4c9385a1bd335fd7dd1d3f887d/dom/serializers/nsDocumentEncoder.cpp#1415-1420.
Updated•4 months ago
|
Updated•4 months ago
|
| Assignee | ||
Comment 3•4 months ago
|
||
The issue is about the UAWidget, there is no issue on normal shadow DOM. nsContentUtils::GetFlattenedTreeAncestorsAndOffsets() ignores the shadowRoot for UAWidget while compute the ancestor, due to https://searchfox.org/firefox-main/rev/f9d8702e26624ab46a35bf6561a7c8143c6f246a/dom/base/nsINode.cpp#4166-4168, but it doesn't do the same while compute the offset. And https://searchfox.org/firefox-main/rev/f9d8702e26624ab46a35bf6561a7c8143c6f246a/dom/serializers/nsDocumentEncoder.cpp#1256 might also need to ignore the UAWidget.
| Assignee | ||
Comment 4•4 months ago
|
||
| Assignee | ||
Comment 5•4 months ago
|
||
Updated•3 months ago
|
| Assignee | ||
Comment 6•3 months ago
|
||
Comment 9•3 months ago
|
||
Backed out for causing mochitest failures @ test_htmlcopyencoder_details
Backout link: https://hg.mozilla.org/integration/autoland/rev/68096a67ac9b3e8a90fe09003ebcc39b2cf95906
Comment 10•3 months ago
|
||
Comment 11•3 months ago
|
||
| bugherder | ||
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Comment 13•2 months ago
|
||
Reproduced with Firefox 146.0a1 (2025-10-16) on macOS 15 ARM.
Verified as fixed with Firefox 150.0a1 (20260303095635) and Firefox 149.0b3 (20260302093328) on macOS 15 ARM, Windows 10 and Ubuntu 22.04.
Description
•