Closed Bug 1421833 Opened 7 years ago Closed 6 years ago

text inside shadow DOM can be selected, but not copied on Android

Categories

(Firefox for Android Graveyard :: General, defect, P2)

All
Android

Tracking

(firefox59 affected)

RESOLVED DUPLICATE of bug 1472421
Tracking Status
firefox59 --- affected

People

(Reporter: anaran, Assigned: edgar)

References

Details

Attachments

(2 files)

Attached file shadowy_testcase.js
New minimal testcase now available at
https://raw.githubusercontent.com/anaran/import/9bf3e184ad4bfffb4b5377f0e03ff64018cf6164/shadowy_testcase.js

Just run it in a Scratchpad on a newly opened tab (Ctrl+T) or just about:blank.

Use Scratchpad in WebIDE to remotely debug on Android device via Wifi or USB.

While text can be selected in each element (pre, textarea, input, div), none of these selections bring up the Android popup to operate on the selection, like Cut Copy, Paste, etc.

While Cut and Paste are understandably not possible at this point due to Bug 1421831, Copy should be possible.
Summary: contentEditable inside customElement are not editable on Android or Linux → text inside customElement can be selected, but not copied on Android
This looks like Shadow DOM thing, not Custom Elements.
Summary: text inside customElement can be selected, but not copied on Android → text inside shadow DOM can be selected, but not copied on Android
minimal testcase would be nice, but I guess I can write such.
Component: DOM → General
Product: Core → Firefox for Android
Jan, do you know if someone familiar with FF-android could take a look?
Flags: needinfo?(jh+bugzilla)
Jim, could you take a look a forward this accordingly? This affects both Fennec and the GeckoView implementation as well.
Flags: needinfo?(jh+bugzilla) → needinfo?(nchen)
Looks like the bug is two fold:

1) CaretStateChangedEvent.selectionVisible [1] is not set to true in AccessibleCaretManager [2] for shadow DOM selections, so we think the selection is not visible and therefore we don't show the copy/paste toolbar. Fixing this alone should make copy/paste work for the GeckoView case.

2) We don't know how to get nsISelection for shadow DOM elements in [3] and [4]. Fixing this and the above should make copy/paste work in Fennec. Fixing this will make the GeckoView implementation behave more correctly as well.

[1] https://searchfox.org/mozilla-central/rev/eb6c5214a63e20a3fff455e92c876287a8d2e188/dom/webidl/CaretStateChangedEvent.webidl#36
[2] https://searchfox.org/mozilla-central/rev/eb6c5214a63e20a3fff455e92c876287a8d2e188/layout/base/AccessibleCaretManager.cpp#1436-1446
[3] https://searchfox.org/mozilla-central/rev/eb6c5214a63e20a3fff455e92c876287a8d2e188/mobile/android/chrome/geckoview/GeckoViewSelectionActionContent.js#93-96
[4] https://searchfox.org/mozilla-central/rev/eb6c5214a63e20a3fff455e92c876287a8d2e188/mobile/android/modules/ActionBarHandler.jsm#763-767
Flags: needinfo?(nchen)
This is one of the few blockers shipping Shadow DOM, so if anyone could take a look at this, great.
Assignee: nobody → echen
After some investigating, I found this issue is caused by the IsInUncomposedDoc checks in nsRange::CollectClientRectsAndText [1] and bug 1472421 have fixed it. So mark as a duplicated of bug 1472421.

[1] https://searchfox.org/mozilla-central/rev/eb6c5214a63e20a3fff455e92c876287a8d2e188/dom/base/nsRange.cpp#3060-3062
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Could we add a test?
Flags: needinfo?(echen)
(In reply to Emilio Cobos Álvarez (:emilio) from comment #10)
> Could we add a test?

The test in bug 1472421 also covers this, IMO.
Flags: needinfo?(echen)
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: