Content in disabled input field should not be selectable
Reported by
quanxunz...@gmail.com,
Jul 8 2016
|
|||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Example URL: data:text/html,<input disabled value="hello"> Steps to reproduce the problem: 1. enter data:text/html,<input disabled value="hello"> 2. try to select the text in the text box What is the expected behavior? Text inside disabled text box should not be selectable. What went wrong? It is selectable. Does it occur on multiple sites: N/A Is it a problem with a plugin? N/A Did this work before? No Does this work in other browsers? No Edge Chrome version: 54.0.2788.0 Channel: canary OS Version: 10.0 Flash Version: There is a note in 4.10.5.3.3 The readonly attribute of the HTML Standard, which says: The difference between disabled and readonly is that read-only controls are still focusable, so the user can still select the text and interact with it, whereas disabled controls are entirely non-interactive. (For this reason, only text controls can be made read-only: it wouldn't make sense for checkboxes or buttons, for instances.) It indicates that disabled input should in general not selectable.
,
Jul 12 2016
@quanxunzhen -- Could you please provide the specific HTML file where the issue is reproducible which would help us triage the issue further. Thanks in Advance.
,
Jul 12 2016
In this HTML file, the text in both form controls should not be selectable per spec.
,
Jul 12 2016
@quanxunzhen -- Thank You for the quick update. Able to reproduce the issue using the html file provided in Comment#3 using Chrome Stable# 51.0.2704.106 and Chrome Canary# 54.0.2794.0 on Windows, Mac and Linux. This is a Non-Regression issue seen from M30# 30.0.1599.101 (Official Build 227552). Changing the status to Untriaged so that the issue could get addressed. Thank you.
,
Jul 13 2016
,
Jul 14 2016
Would like to work on this.
,
Jul 15 2016
ramya.v, OK, I am happy to do reviews.
yoichio, you might be interested in this; I think this could be fixed with a rule like input:disabled { -webkit-user-select: none; }; WDYT since you're working on user-select?
,
Jul 15 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/21d670d3e740b26dcdf63631d163c45a57d9531c commit 21d670d3e740b26dcdf63631d163c45a57d9531c Author: ramya.v <ramya.v@samsung.com> Date: Fri Jul 15 07:37:04 2016 Content in disabled input field should not be selectable. Spec: https://html.spec.whatwg.org/multipage/forms.html#the-readonly-attribute:attr-input-readonly BUG= 626581 Review-Url: https://codereview.chromium.org/2145323002 Cr-Commit-Position: refs/heads/master@{#405717} [modify] https://crrev.com/21d670d3e740b26dcdf63631d163c45a57d9531c/third_party/WebKit/LayoutTests/editing/selection/readonly-disabled-text-selection-expected.txt [modify] https://crrev.com/21d670d3e740b26dcdf63631d163c45a57d9531c/third_party/WebKit/LayoutTests/editing/selection/readonly-disabled-text-selection.html [modify] https://crrev.com/21d670d3e740b26dcdf63631d163c45a57d9531c/third_party/WebKit/LayoutTests/fast/forms/input-readonly-select-expected.txt [modify] https://crrev.com/21d670d3e740b26dcdf63631d163c45a57d9531c/third_party/WebKit/LayoutTests/fast/forms/input-readonly-select.html [modify] https://crrev.com/21d670d3e740b26dcdf63631d163c45a57d9531c/third_party/WebKit/Source/core/dom/Node.cpp [modify] https://crrev.com/21d670d3e740b26dcdf63631d163c45a57d9531c/third_party/WebKit/Source/core/editing/SelectionController.cpp
,
Jul 15 2016
Nice work!
,
Jul 15 2016
,
Oct 3 2016
"What went wrong? It is selectable." Man W3 really messed this one up. Are we actually 'fixing' this by making sure users cannot select the text that is on their screen? What about accessibility?? I never understood this part of the spec but it was just a curiosity because all browsers except Firefox did 'the right thing' and ignored the spec and just made the text that is on the screen selectable so it can be copied / pasted etc, like any user expects (wants). But now that it's no longer ignored, the spec is actually hurting users. input type=disabled was never really usable anyway because of the browser inconsistencies. Mainly due to Firefox not fixing this 13 year old bug https://bugzilla.mozilla.org/show_bug.cgi?id=195361). There are a lot of people on that thread chiming in saying it is a bug, but now that the Chrome team has joined their camp they will never fix it ever. :(
,
Oct 4 2016
Sites should use 'readonly' to make text selectable. On Chrome for Linux, Mac, Windows and Chrome OS you could use a user stylesheet with a !important rule to override the UA stylesheet.
,
Oct 4 2016
The part of the spec quoted appears to be a non-normative note. At first glance, I cannot find any normative statement that controls should not be selectable if disabled. And that fits with the general trend of not prescribing UI affordances to browsers. Probably we should update that non-normative note to remove the mention of selection.
,
Oct 4 2016
Filed https://github.com/whatwg/html/issues/1852 to track this on the spec side. In general I think it's up to Chrome which UI decisions it wants to make for text selection.
,
Oct 12 2016
The spec change has now landed, replacing the inaccurate non-normative note with something which outlines the situation in more depth: https://html.spec.whatwg.org/multipage/forms.html#attr-input-readonly > The difference between disabled and readonly is that read-only controls can still function, whereas disabled controls generally do not function as controls until they are enabled. This is spelled out in more detail elsewhere in this specification with normative requirements that refer to the disabled concept (for example, the element's activation behavior, whether or not it is a focusable area, or when constructing the form data set). Any other behavior related to user interaction with disabled controls, such as whether text can be selected or copied, is not defined in this specification. So whether or not selection is allowed is up to Chrome, and is not a spec-compliance issue. So both the state before and after this bug are OK per spec.
,
Oct 16 2016
Reopening this. The idea is that we would make text in disabled controls selectable again, like Firefox does.
,
Oct 16 2016
Whoops update the title to track the proposal.
,
Oct 17 2016
Let's close this issue, and discuss this if someone files a new bug. r405717 was already shipped, and reusing this for opposite behavior changes would be very confusing.
,
Oct 17 2016
> The idea is that we would make text in disabled controls selectable again, like Firefox does. Firefox currently doesn't make text in disabled controls selectable.
,
Oct 19 2016
,
Oct 26 2016
Well that's ridicules - how do I style a disabled input field to allow the user to select the text?
,
Oct 27 2016
#21 - you either make it read only and/or remove its name attribute (the id attribute is fine, if need be) so it is not submitted when you submit the form.
,
Oct 28 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e16d4aaa97a134e73510e2bce2f99359396f690f commit e16d4aaa97a134e73510e2bce2f99359396f690f Author: yoichio <yoichio@chromium.org> Date: Fri Oct 28 02:37:23 2016 Revert of Content in disabled input field should not be selectable. (patchset #4 id:80001 of https://codereview.chromium.org/2145323002/ ) Reason for revert: It caused regression: https://bugs.chromium.org/p/chromium/issues/detail?id=656736 Original issue's description: > Content in disabled input field should not be selectable. > > Spec: https://html.spec.whatwg.org/multipage/forms.html#the-readonly-attribute:attr-input-readonly > > BUG= 626581 > > Committed: https://crrev.com/21d670d3e740b26dcdf63631d163c45a57d9531c > Cr-Commit-Position: refs/heads/master@{#405717} TBR=tkent@chromium.org,ramya.v@samsung.com # Not skipping CQ checks because original CL landed more than 1 days ago. BUG= 626581 Review-Url: https://codereview.chromium.org/2455853002 Cr-Commit-Position: refs/heads/master@{#428261} [modify] https://crrev.com/e16d4aaa97a134e73510e2bce2f99359396f690f/third_party/WebKit/LayoutTests/editing/selection/readonly-disabled-text-selection-expected.txt [modify] https://crrev.com/e16d4aaa97a134e73510e2bce2f99359396f690f/third_party/WebKit/LayoutTests/editing/selection/readonly-disabled-text-selection.html [modify] https://crrev.com/e16d4aaa97a134e73510e2bce2f99359396f690f/third_party/WebKit/LayoutTests/fast/forms/input-readonly-select-expected.txt [modify] https://crrev.com/e16d4aaa97a134e73510e2bce2f99359396f690f/third_party/WebKit/LayoutTests/fast/forms/input-readonly-select.html [modify] https://crrev.com/e16d4aaa97a134e73510e2bce2f99359396f690f/third_party/WebKit/Source/core/dom/Node.cpp [modify] https://crrev.com/e16d4aaa97a134e73510e2bce2f99359396f690f/third_party/WebKit/Source/core/editing/SelectionController.cpp
,
Oct 31 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4483c37f9c09cb3fc67de11a9833881918980dc8 commit 4483c37f9c09cb3fc67de11a9833881918980dc8 Author: Kent Tamura <tkent@chromium.org> Date: Mon Oct 31 00:47:18 2016 Merge "Revert of Content in disabled input field should not be selectable. (patchset #4 id:80001 of https://codereview.chromium.org/2145323002/ )" to M55 branch Reason for revert: It caused regression: https://bugs.chromium.org/p/chromium/issues/detail?id=656736 Original issue's description: > Content in disabled input field should not be selectable. > > Spec: https://html.spec.whatwg.org/multipage/forms.html#the-readonly-attribute:attr-input-readonly > > BUG= 626581 > > Committed: https://crrev.com/21d670d3e740b26dcdf63631d163c45a57d9531c > Cr-Commit-Position: refs/heads/master@{#405717} TBR=tkent@chromium.org,ramya.v@samsung.com BUG= 626581 Review-Url: https://codereview.chromium.org/2455853002 Cr-Commit-Position: refs/heads/master@{#428261} (cherry picked from commit e16d4aaa97a134e73510e2bce2f99359396f690f) Review URL: https://codereview.chromium.org/2461293002 . Cr-Commit-Position: refs/branch-heads/2883@{#379} Cr-Branched-From: 614d31daee2f61b0180df403a8ad43f20b9f6dd7-refs/heads/master@{#423768} [modify] https://crrev.com/4483c37f9c09cb3fc67de11a9833881918980dc8/third_party/WebKit/LayoutTests/editing/selection/readonly-disabled-text-selection-expected.txt [modify] https://crrev.com/4483c37f9c09cb3fc67de11a9833881918980dc8/third_party/WebKit/LayoutTests/editing/selection/readonly-disabled-text-selection.html [modify] https://crrev.com/4483c37f9c09cb3fc67de11a9833881918980dc8/third_party/WebKit/LayoutTests/fast/forms/input-readonly-select-expected.txt [modify] https://crrev.com/4483c37f9c09cb3fc67de11a9833881918980dc8/third_party/WebKit/LayoutTests/fast/forms/input-readonly-select.html [modify] https://crrev.com/4483c37f9c09cb3fc67de11a9833881918980dc8/third_party/WebKit/Source/core/dom/Node.cpp [modify] https://crrev.com/4483c37f9c09cb3fc67de11a9833881918980dc8/third_party/WebKit/Source/core/editing/SelectionController.cpp
,
Dec 16 2016
Issue 674951 has been merged into this issue.
,
Dec 16 2016
Should this be re-opened, since the fix was reverted?
,
Dec 18 2016
|
|||||||||||||||
►
Sign in to add a comment |
|||||||||||||||
Comment 1 by quanxunz...@gmail.com
, Jul 8 2016