New issue
Advanced search Search tips

Issue 712579 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Selections inside text controls should be of type Range (not Caret)

Reported by hu...@opera.com, Apr 18 2017

Issue description

Chrome Version: 58.0.3029.68 (current beta)
OS: Linux and probably others

What steps will reproduce the problem?
<input value="hey" id="x">
<script>
document.addEventListener("selectionchange", function() {
  const selection = getSelection();
  console.log("selection changed to " + selection.toString() + "(" + selection.type + ")");
});
document.getElementById("x").select();
</script>

What is the expected result?
"selection changed to hey(Range)"

What happens instead?
"selection changed to hey(Caret)"

This works in 57.0.2987.133 (current stable).

The "Selection API" spec does not specify how to handle ranges in text controls but nevertheless, I assume this change was unintentional.
 

Comment 1 by hu...@opera.com, Apr 19 2017

Labels: M-58

Comment 2 by hu...@opera.com, Apr 20 2017

Cc: tkent@chromium.org

Comment 3 by tkent@chromium.org, Apr 20 2017

Cc: -tkent@chromium.org
Components: -Blink>Editing Blink>Editing>Selection
Labels: -Needs-Bisect -M-58 M-59
Owner: tkent@chromium.org
Status: Assigned (was: Available)
I agree that we should fix this.

          type  isCollapsed
Firefox   N/A   true
Edge      Range true
Safari    Range true
Chrome 57 Range true
Chrome 58 Caret true

Comment 4 by tkent@chromium.org, Apr 24 2017

Status: Started (was: Assigned)
Project Member

Comment 5 by bugdroid1@chromium.org, Apr 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ddf851a7d72103c0062bebeb3d3af42b9d5b5c6d

commit ddf851a7d72103c0062bebeb3d3af42b9d5b5c6d
Author: tkent <tkent@chromium.org>
Date: Tue Apr 25 08:36:54 2017

Selection API: type attribute should return 'Range' for range-selection in text controls.

This fixes a regression since Google Chrome 58. New behavior is compatible with
WebKit and Edge. Firefox doesn't have 'type' attribute.

Implementation:
SelectionTemplate<T>::IsCaret() and IsRange() should take care of granularity.

BUG= 712579 

Review-Url: https://codereview.chromium.org/2835063002
Cr-Commit-Position: refs/heads/master@{#466927}

[modify] https://crrev.com/ddf851a7d72103c0062bebeb3d3af42b9d5b5c6d/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure-expected.txt
[modify] https://crrev.com/ddf851a7d72103c0062bebeb3d3af42b9d5b5c6d/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure.html
[modify] https://crrev.com/ddf851a7d72103c0062bebeb3d3af42b9d5b5c6d/third_party/WebKit/Source/core/editing/DOMSelection.cpp
[modify] https://crrev.com/ddf851a7d72103c0062bebeb3d3af42b9d5b5c6d/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp
[modify] https://crrev.com/ddf851a7d72103c0062bebeb3d3af42b9d5b5c6d/third_party/WebKit/Source/core/editing/SelectionTemplate.h

Comment 6 by tkent@chromium.org, Apr 25 2017

Labels: Merge-Request-59
Status: Fixed (was: Started)
Project Member

Comment 7 by sheriffbot@chromium.org, Apr 26 2017

Labels: -Merge-Request-59 Hotlist-Merge-Approved Merge-Approved-59
Your change meets the bar and is auto-approved for M59. Please go ahead and merge the CL to branch 3071 manually. Please contact milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), gkihumba@(ChromeOS), Abdul Syed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 8 by bugdroid1@chromium.org, Apr 27 2017

Labels: -merge-approved-59 merge-merged-3071
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5c24f975838b0d961d333f81f66d1c2267dd1d89

commit 5c24f975838b0d961d333f81f66d1c2267dd1d89
Author: Kent Tamura <tkent@chromium.org>
Date: Thu Apr 27 01:03:10 2017

Merge "Selection API: type attribute should return 'Range' for range-selection in text controls." to M59

This fixes a regression since Google Chrome 58. New behavior is compatible with
WebKit and Edge. Firefox doesn't have 'type' attribute.

Implementation:
SelectionTemplate<T>::IsCaret() and IsRange() should take care of granularity.

BUG= 712579 

Review-Url: https://codereview.chromium.org/2835063002
Cr-Commit-Position: refs/heads/master@{#466927}
(cherry picked from commit ddf851a7d72103c0062bebeb3d3af42b9d5b5c6d)

Review-Url: https://codereview.chromium.org/2840423002 .
Cr-Commit-Position: refs/branch-heads/3071@{#249}
Cr-Branched-From: a106f0abbf69dad349d4aaf4bcc4f5d376dd2377-refs/heads/master@{#464641}

[modify] https://crrev.com/5c24f975838b0d961d333f81f66d1c2267dd1d89/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure-expected.txt
[modify] https://crrev.com/5c24f975838b0d961d333f81f66d1c2267dd1d89/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure.html
[modify] https://crrev.com/5c24f975838b0d961d333f81f66d1c2267dd1d89/third_party/WebKit/Source/core/editing/DOMSelection.cpp
[modify] https://crrev.com/5c24f975838b0d961d333f81f66d1c2267dd1d89/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp
[modify] https://crrev.com/5c24f975838b0d961d333f81f66d1c2267dd1d89/third_party/WebKit/Source/core/editing/SelectionTemplate.h

Kindly let us know in which version of Chrome will get this fixed. We're facing issue with selected text formatting used under Redactor editor. Posted question for same here: http://stackoverflow.com/questions/43674400/redactor-editor-text-format-issues-with-chrome-version-58

Comment 10 by tkent@chromium.org, Apr 28 2017

sandeep.guddu@,
Google Chrome 59 will have the fix.  However, this bug is for INPUT and TEXTAREA, not contenteditable. If your issue is for contenteditable, please find/file another bug.

@tkent, 
Thanks for update. I think our bug is also related to INPUT and TEXTAREA. Can you please let me know by when Google Chrome 59 will be available for end users. It's very critical issues for our users.
#11: The *estimated* stable release date of M59 is June 6

See https://www.chromium.org/developers/calendar

Comment 13 by mci...@gmail.com, Aug 30 2017

Hi, the problem described in http://stackoverflow.com/questions/43674400/redactor-editor-text-format-issues-with-chrome-version-58 still exists in chrome version 60. Has this been fixed? If not, when can be expect it to be fixed?

Sign in to add a comment