Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queryCommandSupported('paste') clarification for Chrome #167

Closed
RobertBColton opened this issue Aug 21, 2017 · 4 comments
Closed

queryCommandSupported('paste') clarification for Chrome #167

RobertBColton opened this issue Aug 21, 2017 · 4 comments

Comments

@RobertBColton
Copy link

Building an HTML5 application with clipboard support, I intended to use queryCommandSupported to disable cut, copy, and paste buttons if they were not supported. This worked fine in all browsers except for Chrome, which always returns true for all 3 commands, even if they are not "supported."

In Chrome 61, even though queryCommandSupported('paste') returns true, document.execCommand('paste') will always return false and do nothing. It does execute the paste command if executed from a Chrome extension though.

I reported this to the Chrome dev team and they would like some clarification because they feel the spec is ambiguous.
https://bugs.chromium.org/p/chromium/issues/detail?id=757140#c4

Could someone please clarify whether Chrome is doing what the spec intends by returning true at all times from queryCommandSupported('paste')?

@rniwa
Copy link
Contributor

rniwa commented Aug 22, 2017

This is just a bug in Chrome's implementation. Since Chrome doesn't allow execCommand('paste'), it should just return false in queryCommandSupported('paste'). Maybe it supports when the webpage is "installed" or something? But if that's the case, it should continue to return false until the web app is installed.

@johanneswilm
Copy link
Contributor

We did discuss this at the meeting today:

RESOLUTION: Spec should say that supported should be false if you are in an environment where you are always going to fail. [1]

[1] https://www.w3.org/2017/09/05-editing-minutes.html

@johanneswilm
Copy link
Contributor

@yosinch Please reopen if it still does not seem clear.

@yosinch
Copy link

yosinch commented Sep 6, 2017

Thanks Johannes. The statement is clear for me.
It is nice that the "paste" section has a condition when queryCommandSupported() return false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants