Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 59 users
Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jul 2015
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocked on:
issue 360454
issue 483376



Sign in to add a comment
setSelectionRange() for input/textarea during onFocus fails when mouse clicks
Reported by myoncein...@gmail.com, Jan 22 2010 Back to list
Chrome Version       : 4.0.295.0 (Official Build 35884) dev
URLs (if applicable) :
Other browsers tested: FF 3.5, IE8
Add OK or FAIL after other browsers where you have tested this issue:
Safari 4:
  Firefox 3.x:OK
IE 7:
         IE 8:OK

What steps will reproduce the problem?
1. Put the following in an html document: <input type="text" value="value" 
onFocus="this.setSelectionRange(0,this.value.length);" />
2. click on the text box with the mouse

What is the expected result?
The text "value" should be selected.


What happens instead?
The text "value" is briefly selected and then the cursor position is set to the location the mouse clicked, 
removing the selection.


Please provide any additional information below. Attach a screenshot if
possible.

All other browsers simply select the text. I put the code in the latest event onMouseUp() and the exact same 
thing happened.

The only workaround for chrome is to schedule a setTimeout() timer with a delay of 1ms. Then the selection 
occurs AFTER the positioning of the cursor.

 
Comment 1 Deleted
Labels: -Area-Undefined autoclass-3 Area-Webkit
Using an automated filter to classify this issue into an area...gulp
Labels: -autoclass-3
Comment 4 by karen@chromium.org, Feb 22 2010
Labels: Mstone-X
uTest
Repro in dev build: Y
Repro in stable build: Y
Accurate Steps: Y
Configuration used: 5.0.375.70 + 6.0.437.3 + Windows 7 x64

This is reproducible on both configs.
Possible work around:
Place setSelectionRange call inside a setTimeout e.g.

var that = this;

setTimeout(function () {
    that.setSelectionRange(...);
}, 0)

No idea why this works.
Comment 7 by rass...@gmail.com, Sep 10 2010
It works because of event order. In Chrome event focus drop selection range, so if you set some timeout (even zero), you will place selection function after end of focus event. 
So everything fine, but such behavior is strange - other browsers work with selection on focus fine.
Comment 8 by tkent@chromium.org, Feb 18 2011
 Issue 73277  has been merged into this issue.
Comment 9 by tkent@chromium.org, Aug 9 2012
Labels: WebKit-Forms
Project Member Comment 10 by bugdroid1@chromium.org, Aug 10 2012
Labels: -Pri-2 Pri-3 Action-NeedsReview
Status: IceBox
Due to the age of the issue, changing the priority to P3, however because it has at least 10 stars, marking it for review.
Comment 11 by laforge@google.com, Aug 10 2012
Status: Unconfirmed
Comment 12 by tkent@chromium.org, Aug 11 2012
Labels: -Mstone-X -Pri-3 -Action-NeedsReview Pri-2 OS-All
Status: Available
Confirmed on 21.0.1180.75 Windows.

Project Member Comment 13 by bugdroid1@chromium.org, Mar 10 2013
Labels: -Area-Webkit -WebKit-Forms Cr-Content Cr-Content-Forms
Project Member Comment 14 by bugdroid1@chromium.org, Apr 6 2013
Labels: -Cr-Content Cr-Blink
Project Member Comment 15 by bugdroid1@chromium.org, Apr 6 2013
Labels: -Cr-Content-Forms Cr-Blink-Forms
 Issue 228851  has been merged into this issue.
Summary: setSelectionRange() for input/textarea during onFocus fails when mouse clicks (was: TextBox.setSelectionRange during onFocus fails when mouse clicks)
Labels: Hotlist-Fixit
http://jsfiddle.net/9CzQs/
Seems annoying, might be a good candidate for a fixit.
Cc: kenjibaheux@chromium.org
Comment 20 by tkent@chromium.org, Mar 12 2014
Labels: -Cr-Blink Cr-Blink-Events
WebKit and Blink handle tasks for mousedown in the following order:
 1. Focus
 2. Selection
The order looks reversed in other browsers

See Source/core/page/EventHandler.cpp.  Fixing this looks very hard.


Owner: tkent@chromium.org
Status: Started
Blockedon: chromium:360454
Comment 23 by tkent@chromium.org, Apr 25 2014
Labels: Cr-Blink-Forms-Text Cr-Blink-Forms-Textarea
Owner: ----
Status: Available
Owner: myid.o.s...@gmail.com
Project Member Comment 27 by bugdroid1@chromium.org, Sep 6 2014
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=181490

------------------------------------------------------------------
r181490 | myid.o.shin@gmail.com | 2014-09-06T12:45:56.403018Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/EventHandler.cpp?r1=181490&r2=181489&pathrev=181490
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-within-events.html?r1=181490&r2=181489&pathrev=181490
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/EventHandler.h?r1=181490&r2=181489&pathrev=181490
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/FrameSelection.cpp?r1=181490&r2=181489&pathrev=181490
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-within-events-expected.txt?r1=181490&r2=181489&pathrev=181490
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/FrameSelection.h?r1=181490&r2=181489&pathrev=181490

Fix to keep the selection of the text field in input element after setSelectionRange is called by dom events related to mouse

The problem is that the selection is cleared when handling mouse release.
The selection should be kept if the selection is set by setSelectionRange during handling mouse event.

BUG= 32865 
R=yosin@chromium.org
R=rbyers@chromium.org
TEST=LayoutTests/fast/forms/setrangetext-within-events.html

Review URL: https://codereview.chromium.org/507533002
-----------------------------------------------------------------
Project Member Comment 28 by bugdroid1@chromium.org, Sep 8 2014
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=181565

------------------------------------------------------------------
r181565 | ppi@chromium.org | 2014-09-08T15:57:18.172059Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/EventHandler.h?r1=181565&r2=181564&pathrev=181565
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/FrameSelection.cpp?r1=181565&r2=181564&pathrev=181565
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-within-events-expected.txt?r1=181565&r2=181564&pathrev=181565
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/FrameSelection.h?r1=181565&r2=181564&pathrev=181565
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/EventHandler.cpp?r1=181565&r2=181564&pathrev=181565
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-within-events.html?r1=181565&r2=181564&pathrev=181565

Revert of Fix to keep the selection of the text field in input element after setSelectionRange is called by d… (patchset #7 id:160001 of https://codereview.chromium.org/507533002/)

Reason for revert:
Suspected cause of flaky failures of org.chromium.content.browser.input.ImeTest on Android bots - see  http://crbug.com/411756 

Original issue's description:
> Fix to keep the selection of the text field in input element after setSelectionRange is called by dom events related to mouse
> 
> The problem is that the selection is cleared when handling mouse release.
> The selection should be kept if the selection is set by setSelectionRange during handling mouse event.
> 
> BUG= 32865 
> R=yosin@chromium.org
> R=rbyers@chromium.org
> TEST=LayoutTests/fast/forms/setrangetext-within-events.html
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=181490

TBR=yosin@chromium.org,yoichio@chromium.org,rbyers@chromium.org,kenjibaheux@chromium.org,myid.o.shin@gmail.com
NOTREECHECKS=true
NOTRY=true
BUG= 32865 

Review URL: https://codereview.chromium.org/548413002
-----------------------------------------------------------------
Project Member Comment 29 by bugdroid1@chromium.org, Sep 14 2014
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=181959

------------------------------------------------------------------
r181959 | myid.o.shin@gmail.com | 2014-09-14T12:55:26.805284Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/EventHandler.h?r1=181959&r2=181958&pathrev=181959
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/FrameSelection.cpp?r1=181959&r2=181958&pathrev=181959
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-within-events-expected.txt?r1=181959&r2=181958&pathrev=181959
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/FrameSelection.h?r1=181959&r2=181958&pathrev=181959
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/EventHandler.cpp?r1=181959&r2=181958&pathrev=181959
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-within-events.html?r1=181959&r2=181958&pathrev=181959

Fix to keep the selection of the text field in input element after setSelectionRange is called by dom events related to mouse

The problem is that the selection is cleared when handling mouse release.
The selection should be kept if the selection is set by setSelectionRange during handling mouse event.

BUG= 32865 
R=yosin@chromium.org
R=rbyers@chromium.org
TEST=LayoutTests/fast/forms/setrangetext-within-events.html

Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=181490

Review URL: https://codereview.chromium.org/507533002
-----------------------------------------------------------------
Comment 30 by tkent@chromium.org, Sep 15 2014
Labels: M-39
Status: Fixed
Comment 31 by adob...@gmail.com, Nov 26 2014
This onfocus behavior is still buggy.

Consider the example:

<input type="text" 
       value="value" 
       onfocus="this.setSelectionRange(0,this.value.length-2);">

After clicking on the input text box, the substring "val" should become selected. However, when clicking the substring "ue", the expected text is not selected, and the caret is placed as though had there been no setSelectionRange() call.

Works correctly in Firefox.
Status: Assigned
#31,
I can reproduce the issue adob321 mentioned.
I will take a look.
Project Member Comment 33 by bugdroid1@chromium.org, Dec 4 2014
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=186550

------------------------------------------------------------------
r186550 | myid.o.shin@gmail.com | 2014-12-04T23:41:42.316907Z

Changed paths:
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-out-of-range-expected.txt?r1=186550&r2=186549&pathrev=186550
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-out-of-range.html?r1=186550&r2=186549&pathrev=186550
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/EventHandler.cpp?r1=186550&r2=186549&pathrev=186550

Fix the problem to keep the selection when clicking the substring out of range

The problem is that it's not consistent to keep the selection when clicking the
substiring in/out of range. We need the additional condition missing
from http://crrev.com/507533002

BUG= 32865 , 438102 
R=yosin@chromium.org
R=rbyers@chromium.org
TEST=fast/forms/setrangetext-out-of-range.html

Review URL: https://codereview.chromium.org/764313004
-----------------------------------------------------------------
Status: Fixed
Comment 35 by tkent@chromium.org, Feb 12 2015
Cc: anan...@chromium.org
 Issue 4505  has been merged into this issue.
Status: Assigned
Re-open: fix is being reverted: https://codereview.chromium.org/965203003/

There's obviously a lot of subtle behavior that's tough to get right :-(
Project Member Comment 37 by bugdroid1@chromium.org, Mar 3 2015
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=191215

------------------------------------------------------------------
r191215 | myid.o.shin@gmail.com | 2015-03-03T23:53:23.443760Z

Changed paths:
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-within-events-expected.txt?r1=191215&r2=191214&pathrev=191215
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-reset-selection-range.html?r1=191215&r2=191214&pathrev=191215
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/FrameSelection.h?r1=191215&r2=191214&pathrev=191215
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-setrangetext-with-events-expected.txt?r1=191215&r2=191214&pathrev=191215
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-out-of-range.html?r1=191215&r2=191214&pathrev=191215
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/EventHandler.cpp?r1=191215&r2=191214&pathrev=191215
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-within-events.html?r1=191215&r2=191214&pathrev=191215
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/EventHandler.h?r1=191215&r2=191214&pathrev=191215
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html?r1=191215&r2=191214&pathrev=191215
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-reset-selection-range-expected.txt?r1=191215&r2=191214&pathrev=191215
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/FrameSelection.cpp?r1=191215&r2=191214&pathrev=191215
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-out-of-range-expected.txt?r1=191215&r2=191214&pathrev=191215

Revert 187103 "Fix ignored taps in contextual search on Android"
Revert 186550 "Fix the problem to keep the selection when clicking..."
Revert 185410 "Make sure that selection is cleared after tapping."
Revert 181959 "Fix to keep the selection of the text field in input..."

Reason for revert:
Cursor doesn't enter into Password field text-box on first tap
on Handsets & Tablets of Android.
First I revert the origin patch related to the selection, then
I will check this issue.

Revert 187103 :
> Fix ignored taps in contextual search on Android
>
> We should keep the selection when tapping-press and clear
> the selection state after tapping release.
> Focus, mouse-down and mouse-press events are triggered on
> tapping. The problem is that the selection state was
> initialized after handling mouse-press event.
> We should initialize it after handling mousedown event like
> the formal mouse event.
>
> BUG= 440086 
> R=rbyers@chromium.org,donnd@chromium.org,yosin@chromium.org
> TEST=fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html

Revert 186550 :
> Fix the problem to keep the selection when clicking the substring out of ran
>
> The problem is that it's not consistent to keep the selection when clicking
> substiring in/out of range. We need the additional condition missing
> from http://crrev.com/507533002
>
> BUG= 32865 , 438102 
> R=yosin@chromium.org
> R=rbyers@chromium.org
> TEST=fast/forms/setrangetext-out-of-range.html

Revert 185410 :
> Make sure that selection is cleared after tapping.
>
> The problem is that Selection is not getting cleared
> after tapping of gesture. This was affected by
> https://codereview.chromium.org/507533002,
> because initialization for m_selectionInitiationState was
> skipped in case of gesture.
> This patch makes m_selectionInitiationState be initialized
> after dispatching mousedown event for gesture tapping.
>
> BUG= 429967 
> R=rbyers@chromium.org
> TEST=LayoutTests/fast/events/touch/gesture/gesture-tap-reset-selection-range

Revert 181959:
> Fix to keep the selection of the text field in input element after setSelect
>
> The problem is that the selection is cleared when handling mouse release.
> The selection should be kept if the selection is set by setSelectionRange du
>
> BUG= 32865 
> R=yosin@chromium.org
> R=rbyers@chromium.org
>TEST=LayoutTests/fast/forms/setrangetext-within-events.html

BUG=457147
R=rbyers@chromium.org, yosin@chromium.org, donnd@chromium.org

Review URL: https://codereview.chromium.org/965203003
-----------------------------------------------------------------
Project Member Comment 38 by bugdroid1@chromium.org, Mar 4 2015
Labels: merge-merged-2272
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=191218

------------------------------------------------------------------
r191218 | kerz@chromium.org | 2015-03-04T00:33:09.216656Z

Changed paths:
   D http://src.chromium.org/viewvc/blink/branches/chromium/2272/LayoutTests/fast/events/touch/gesture/gesture-tap-reset-selection-range-expected.txt?r1=191218&r2=191217&pathrev=191218
   M http://src.chromium.org/viewvc/blink/branches/chromium/2272/Source/core/editing/FrameSelection.cpp?r1=191218&r2=191217&pathrev=191218
   D http://src.chromium.org/viewvc/blink/branches/chromium/2272/LayoutTests/fast/forms/setrangetext-out-of-range-expected.txt?r1=191218&r2=191217&pathrev=191218
   D http://src.chromium.org/viewvc/blink/branches/chromium/2272/LayoutTests/fast/forms/setrangetext-within-events-expected.txt?r1=191218&r2=191217&pathrev=191218
   D http://src.chromium.org/viewvc/blink/branches/chromium/2272/LayoutTests/fast/events/touch/gesture/gesture-tap-reset-selection-range.html?r1=191218&r2=191217&pathrev=191218
   M http://src.chromium.org/viewvc/blink/branches/chromium/2272/Source/core/editing/FrameSelection.h?r1=191218&r2=191217&pathrev=191218
   D http://src.chromium.org/viewvc/blink/branches/chromium/2272/LayoutTests/fast/events/touch/gesture/gesture-tap-setrangetext-with-events-expected.txt?r1=191218&r2=191217&pathrev=191218
   D http://src.chromium.org/viewvc/blink/branches/chromium/2272/LayoutTests/fast/forms/setrangetext-out-of-range.html?r1=191218&r2=191217&pathrev=191218
   M http://src.chromium.org/viewvc/blink/branches/chromium/2272/Source/core/page/EventHandler.cpp?r1=191218&r2=191217&pathrev=191218
   D http://src.chromium.org/viewvc/blink/branches/chromium/2272/LayoutTests/fast/forms/setrangetext-within-events.html?r1=191218&r2=191217&pathrev=191218
   M http://src.chromium.org/viewvc/blink/branches/chromium/2272/Source/core/page/EventHandler.h?r1=191218&r2=191217&pathrev=191218
   D http://src.chromium.org/viewvc/blink/branches/chromium/2272/LayoutTests/fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html?r1=191218&r2=191217&pathrev=191218

Merge 191215 "Revert 187103 "Fix ignored taps in contextual sear..."

> Revert 187103 "Fix ignored taps in contextual search on Android"
> Revert 186550 "Fix the problem to keep the selection when clicking..."
> Revert 185410 "Make sure that selection is cleared after tapping."
> Revert 181959 "Fix to keep the selection of the text field in input..."
> 
> Reason for revert:
> Cursor doesn't enter into Password field text-box on first tap
> on Handsets & Tablets of Android.
> First I revert the origin patch related to the selection, then
> I will check this issue.
> 
> Revert 187103 :
> > Fix ignored taps in contextual search on Android
> >
> > We should keep the selection when tapping-press and clear
> > the selection state after tapping release.
> > Focus, mouse-down and mouse-press events are triggered on
> > tapping. The problem is that the selection state was
> > initialized after handling mouse-press event.
> > We should initialize it after handling mousedown event like
> > the formal mouse event.
> >
> > BUG= 440086 
> > R=rbyers@chromium.org,donnd@chromium.org,yosin@chromium.org
> > TEST=fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html
> 
> Revert 186550 :
> > Fix the problem to keep the selection when clicking the substring out of ran
> >
> > The problem is that it's not consistent to keep the selection when clicking
> > substiring in/out of range. We need the additional condition missing
> > from http://crrev.com/507533002
> >
> > BUG= 32865 , 438102 
> > R=yosin@chromium.org
> > R=rbyers@chromium.org
> > TEST=fast/forms/setrangetext-out-of-range.html
> 
> Revert 185410 :
> > Make sure that selection is cleared after tapping.
> >
> > The problem is that Selection is not getting cleared
> > after tapping of gesture. This was affected by
> > https://codereview.chromium.org/507533002,
> > because initialization for m_selectionInitiationState was
> > skipped in case of gesture.
> > This patch makes m_selectionInitiationState be initialized
> > after dispatching mousedown event for gesture tapping.
> >
> > BUG= 429967 
> > R=rbyers@chromium.org
> > TEST=LayoutTests/fast/events/touch/gesture/gesture-tap-reset-selection-range
> 
> Revert 181959:
> > Fix to keep the selection of the text field in input element after setSelect
> >
> > The problem is that the selection is cleared when handling mouse release.
> > The selection should be kept if the selection is set by setSelectionRange du
> >
> > BUG= 32865 
> > R=yosin@chromium.org
> > R=rbyers@chromium.org
> >TEST=LayoutTests/fast/forms/setrangetext-within-events.html
> 
> BUG=457147
> R=rbyers@chromium.org, yosin@chromium.org, donnd@chromium.org
> 
> Review URL: https://codereview.chromium.org/965203003

TBR=myid.o.shin@gmail.com

Review URL: https://codereview.chromium.org/975233002
-----------------------------------------------------------------
Blockedon: chromium:483376
Project Member Comment 40 by bugdroid1@chromium.org, Jul 13 2015
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=198752

------------------------------------------------------------------
r198752 | myid.o.shin@gmail.com | 2015-07-13T06:44:59.734798Z

Changed paths:
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-within-events.html?r1=198752&r2=198751&pathrev=198752
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/SelectionController.cpp?r1=198752&r2=198751&pathrev=198752
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/input/EventHandler.cpp?r1=198752&r2=198751&pathrev=198752
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html?r1=198752&r2=198751&pathrev=198752
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/SelectionController.h?r1=198752&r2=198751&pathrev=198752
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/FrameSelection.cpp?r1=198752&r2=198751&pathrev=198752
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-input-after-composition.html?r1=198752&r2=198751&pathrev=198752
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-reset-selection-range.html?r1=198752&r2=198751&pathrev=198752
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/FrameSelection.h?r1=198752&r2=198751&pathrev=198752
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/forms/setrangetext-out-of-range.html?r1=198752&r2=198751&pathrev=198752

Keep the selection of the text field when changed by JS.

Fixed to keep the selection of the text field in the input
element after setSelectionRange is called by dom events 
when triggering the mouse event or the tap event.

The problem is that the selection is cleared when handling
mouse release. The selection should be kept if the
selection is set by setSelectionRange during handling the
mouse/tap event.

BUG= 32865 ,  429967 ,  438102 ,  440086 , 457147
R=yosin@chromium.org, rbyers@chromium.org
TEST=
fast/events/touch/gesture/gesture-tap-input-after-composition.html
fast/events/touch/gesture/gesture-tap-reset-selection-range.html
fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html
fast/forms/setrangetext-out-of-range.html
fast/forms/setrangetext-within-events.html

Review URL: https://codereview.chromium.org/1049233003
-----------------------------------------------------------------
Comment 41 by yosin@chromium.org, Jul 13 2015
Status: Fixed
Comment 42 by tkent@chromium.org, Jul 14 2015
Labels: -M-39 M-46
Sign in to add a comment