Open Bug 1578321 Opened 2 years ago Updated 14 days ago

Consider exposing clipboard.readText to web content

Categories

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

enhancement
Not set
normal

Tracking

()

People

(Reporter: xidorn, Assigned: mbrodesser)

References

(Blocks 1 open bug, )

Details

(Keywords: dev-doc-needed, parity-chrome, parity-safari)

It is initially implemented in bug 1479935 but only exposed to WebExtensions. However, there is no such restriction in the spec, so supposedly it should be exposed to the web content, especially that Chrome has already been doing so.

I don't see any bug tracking that, so created one. Please dup if there is already any.

Blocks: 1619251
Duplicate of this bug: 1664318

Presumably this would also make document.execCommand('paste') work?

Safari's UI of showing an inline "Paste" contextmenu item seems like a reasonable UI approach here that keeps the user in control over the clipboard. (They only show this when the page wasn't the source of the data on the clipboard, which seems reasonable, though also gives away some information.)

(What's a bit worrying though is that the specification isn't maintained. I raised pretty serious issues with the write() method last year that are still unaddressed. And it would have been better if these methods also worked for drag-and-drop, but I guess with Chrome and Safari shipping blocking on that is somewhat futile.)

Component: DOM: Core & HTML → DOM: Serializers
Duplicate of this bug: 1272296
Blocks: 1295692

Would it be possible to make clipboard.readText work in paste events? I think this might help with situations like this on stackoverflow where the code isn't using the event.clipboardData information for some reason.

What does Safari do?

Component: DOM: Serializers → DOM: Copy & Paste and Drag & Drop

On our app it's not possible, in a modern and secure way, to create a simple paste button. We are forced to remove this functionality for firefox users :/ Please expose it 😇

See Also: → 1472338
Assignee: nobody → mbrodesser
Depends on: 1727271
Depends on: 1731264
Depends on: 1731994

For the record: we'll add a "Paste" button for this, similar to Safari's. The rationale can be found at https://docs.google.com/document/d/1O7gHaPS7G1IuNg2yv5PXX6-T9-h6QVaWGeLwpkLlbVA/edit?usp=sharing.

You need to log in before you can comment on or make changes to this bug.