Read clipboard get empty string when inside async function or callback after event loop
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, defect)
Tracking
()
People
(Reporter: linonetwo012, Unassigned)
References
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:106.0) Gecko/20100101 Firefox/106.0
Steps to reproduce:
https://stackblitz.com/edit/firefox-async-read-cllipboard-bug?file=index.ts
In WYSIWYG editor, we read clipboard using clipboardData?.getData('text') , and gets empty string. See link above for a reproduce.
We are optimizing performance by moving operations like reading clipboard to some async functions, and encountered this bug.
Actual results:
clipboardData?.getData('text') returns empty string
Expected results:
Should return acturial clipboard data like inside a sync function.
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Editor' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•3 years ago
|
Comment 2•3 years ago
|
||
Basically, we intentionally nuke the data from the DataTransfer when the event is done dispatching, so does Chrome.
For Promise.resolve case, we behave differently on resolving promise than Chrome regarding the microtask checkpoint, so it works on Chrome but not us.
For setTimeout case, both Chrome and us doesn't work.
Updated•1 year ago
|
Updated•1 year ago
|
Description
•