Touch event doesn't recognize user activation for clipboard.readText()
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, defect, P3)
Tracking
()
People
(Reporter: m_kato, Unassigned)
References
(Blocks 1 open bug, )
Details
Environment
- Surface Pro 4 + Windows 10
Step
- dom.events.asyncClipboard.readText=true
- Open https://www.wontfix.net/bugs/readtext.html
- Tap "readtext (by touchstart)" button using touch device.
Result
DOMException: navigator.clipboard.readText() was blocked due to lack of user activation.
Expected.
Even if touch event, it should be user activation. Chrome work expected.
Other
Even if pointer event (pointerdown) has same problem if using touch device. If using mouse, no problem.
Comment 1•2 years ago
|
||
I could also reproduce the issue by leaving the page idle for a while (> 5 sec, in order to make the transient activation timeout) then clicks "readtext (by pointerdown)" button twice. I got DOMException: navigator.clipboard.readText() was blocked due to lack of user activation.
for first click and Uncaught (in promise) DOMException: The user dismissed the 'Paste' button.
for the second click.
There are two issue here,
1). The first pointerdown/touchstart doesn't activate the document, I think it is because https://searchfox.org/mozilla-central/rev/284187d0a7130d21042beeff0af0627c8e68cacc/dom/events/EventStateManager.cpp#752-754
2). The paste button somehow be dismissed, maybe because of the subsequent synthesized mouse down event for touch?
Comment 2•2 years ago
|
||
"Activation triggering input events" excludes the "touchstart" event, but includes the "touchend" event, see https://html.spec.whatwg.org/multipage/interaction.html#activation-triggering-input-event. That trigger is used to set the last activation timestamp, see https://html.spec.whatwg.org/multipage/interaction.html#user-activation-processing-model. That timestamp is used to determine whether there's transient user activation, see https://html.spec.whatwg.org/multipage/interaction.html#transient-activation.
Either the spec should be updated, or Chrome should change its behavior. For webcompat, it'd be interesting to know how Safari behaves.
Comment 3•2 years ago
|
||
Other
Even if pointer event (pointerdown) has same problem if using touch device. If using mouse, no problem.
It's according to spec: https://html.spec.whatwg.org/multipage/interaction.html#activation-triggering-input-event.
Comment 4•2 years ago
|
||
There is a spec discussion around pointerdown event for touch, see https://github.com/whatwg/html/issues/7341.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Description
•