Open Bug 1778437 Opened 2 years ago Updated 2 years ago

Touch event doesn't recognize user activation for clipboard.readText()

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect, P3)

Unspecified
All
defect

Tracking

()

People

(Reporter: m_kato, Unassigned)

References

(Blocks 1 open bug, )

Details

Environment

  • Surface Pro 4 + Windows 10

Step

  1. dom.events.asyncClipboard.readText=true
  2. Open https://www.wontfix.net/bugs/readtext.html
  3. 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.

Blocks: 1776843

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?

"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.

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.

There is a spec discussion around pointerdown event for touch, see https://github.com/whatwg/html/issues/7341.

Severity: -- → S3
Priority: -- → P3
Blocks: 1577516
You need to log in before you can comment on or make changes to this bug.