New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 626581 link

Starred by 6 users

Issue metadata

Status: WontFix
Owner:
Last visit > 30 days ago
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 3
Type: Compat

Blocking:
issue 656736



Sign in to add a comment

Content in disabled input field should not be selectable

Reported by quanxunz...@gmail.com, Jul 8 2016

Issue description

UserAgent: 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.
 
Cc: msrchandra@chromium.org
Labels: Needs-Feedback
@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.
In this HTML file, the text in both form controls should not be selectable per spec.
disabled.html
307 bytes View Download
Components: Blink>HTML
Labels: -Needs-Feedback M-54 OS-Linux OS-Mac
Status: Untriaged (was: Unconfirmed)
@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.

Comment 5 by tkent@chromium.org, Jul 13 2016

Components: -Blink>HTML Blink>Forms>Text
Labels: -M-54 Hotlist-GoodFirstBug
Status: Available (was: Untriaged)

Comment 6 by ramy...@samsung.com, Jul 14 2016

Owner: ramy...@samsung.com
Status: Assigned (was: Available)
Would like to work on this.
Cc: yoichio@chromium.org dominicc@chromium.org
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?
Status: Fixed (was: Assigned)
Nice work!

Comment 10 by tkent@chromium.org, Jul 15 2016

Labels: M-54
"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.  :(
Cc: domenic@chromium.org
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.
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.
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.
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.
Cc: ramy...@samsung.com
Labels: -Pri-2 Pri-3
Owner: ----
Status: Untriaged (was: Fixed)
Reopening this. The idea is that we would make text in disabled controls selectable again, like Firefox does.
Summary: Content in disabled input field *should* be selectable (was: Content in disabled input field is still selectable)
Whoops update the title to track the proposal.

Comment 18 by tkent@chromium.org, Oct 17 2016

Owner: ramy...@samsung.com
Status: Fixed (was: Untriaged)
Summary: Content in disabled input field should not be selectable (was: Content in disabled input field *should* be selectable)
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.

> 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.

Comment 20 by tkent@chromium.org, Oct 19 2016

Blocking: 656736

Comment 21 by kesse...@gmail.com, Oct 26 2016

Well that's ridicules - how do I style a disabled input field to allow the user to select the text?

Comment 22 by phistuck@gmail.com, 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.
Project Member

Comment 23 by bugdroid1@chromium.org, 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

Project Member

Comment 24 by bugdroid1@chromium.org, Oct 31 2016

Labels: merge-merged-2883
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

 Issue 674951  has been merged into this issue.

Comment 26 by phistuck@gmail.com, Dec 16 2016

Should this be re-opened, since the fix was reverted?

Comment 27 by tkent@chromium.org, Dec 18 2016

Status: WontFix (was: Fixed)

Sign in to add a comment