document.queryCommandSupported('paste') returns true when not actually supported
Reported by
robertbcolton@gmail.com,
Aug 19 2017
|
|||||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0
Steps to reproduce the problem:
Call document.queryCommandSupported('paste') and see if it matches whether document.execCommand('paste') is successful.
What is the expected behavior?
If document.queryCommandSupported('paste') returns true then document.execCommand('paste') should work without a plugin.
What went wrong?
document.queryCommandSupported('paste') returns true but execCommand('paste') fails.
Did this work before? N/A
Does this work in other browsers? Yes
Chrome version: Google Chrome 61.0.3163.49 (Official Build) beta (64-bit) (cohort: Beta) Channel: n/a
OS Version: 10.0
Flash Version: Shockwave Flash 24.0 r0
queryCommandSupported should correctly return false if the browser does not support the paste command so UI elements can be enabled/disabled accordingly. In my app I want to disable the paste button, if it is not supported, and display a tooltip, using the title attribute, explaining to use the keyboard shortcut instead (as in Google Docs, but without using a dialog).
,
Aug 21 2017
Mark WontFix since document.queryCommandSupported('paste') always returns true[1].
Please use document.queryCommandEnabled('paste') to check whether 'paste' command
is enabled or disabled.
[1] https://w3c.github.io/editing/execCommand.html#supported-commands
,
Aug 21 2017
No, the command must "not be supported per: "A command that does absolutely nothing in a particular user agent, such that execCommand() never has any effect and queryCommandEnabled() and queryCommandIndeterm() and queryCommandState() and queryCommandValue() each return the same value all the time, must not be supported." So this issue should be fixed and supported should return false, as Edge, Firefox, and Safari do, because the paste command does nothing.
,
Aug 21 2017
Could you file an issue to w3c editing issue tracker[1]?
Since, the spec is ambiguous, w3c editing task force should make the spec clear.
It seems WebKit checks clipboard access for queryCommandSupported('paste')[2]
There are similar discussion for queryCommandEnable('copy')[3]
[1] https://github.com/w3c/editing/issues
[2] https://trac.webkit.org/changeset/74580/webkit/trunk/WebCore/editing/EditorCommand.cpp
[3] https://github.com/w3c/editing/issues/161
,
Aug 21 2017
I've filed an issue with the w3c editing task force here: https://github.com/w3c/editing/issues/167 In my opinion, I do not believe what Chrome does is correct. The problem with queryCommandEnable is that it doesn't apply to buttons like it does context menu's. For a clipboard button you would want the button to focus the widget, if it's not focused, before performing its command. The user expects that clicking the button will focus the list/tree/etc. This is perhaps best demonstrated by the WAI-ARIA listbox example: https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox.html In the case that what the button performs is not supported (such as a clipboard action) you would want to disable the button.
,
Sep 5 2017
I just got a response from the W3C editing task force and they have confirmed that Chrome's behavior is in fact a bug and non-compliant with the standard: https://github.com/w3c/editing/issues/167#issuecomment-327293494 https://www.w3.org/2017/09/05-editing-minutes.html
,
Sep 6 2017
Mark Available to pick this up by someone regarding to #c6
,
Sep 11 2017
I will take this up
,
Sep 15 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/29e7204c4d91b754fe8df8e264695a695a5ab974 commit 29e7204c4d91b754fe8df8e264695a695a5ab974 Author: tanvir.rizvi <tanvir.rizvi@samsung.com> Date: Fri Sep 15 08:06:44 2017 Update queryCommandSupported for paste command Currently queryCommandSupported('paste') always returns true, even when execCommand('paste') fails, As per the recent spec updates[1] queryCommandSupported should return false if the environment do not support. [1] https://w3c.github.io/editing/execCommand.html#supported-commands Bug: 757140 Change-Id: I42e8f645f46df632e38f8fe2a61a1143466a3387 Reviewed-on: https://chromium-review.googlesource.com/664777 Commit-Queue: Tanvir Rizvi <tanvir.rizvi@samsung.com> Commit-Queue: Yoshifumi Inoue <yosin@chromium.org> Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org> Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Cr-Commit-Position: refs/heads/master@{#502199} [modify] https://crrev.com/29e7204c4d91b754fe8df8e264695a695a5ab974/third_party/WebKit/LayoutTests/editing/pasteboard/copy-cut-paste-supported.html [modify] https://crrev.com/29e7204c4d91b754fe8df8e264695a695a5ab974/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
,
Nov 13 2017
,
Jan 10 2018
,
Feb 26 2018
|
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by tkent@chromium.org
, Aug 20 2017