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 24 users

Issue metadata

Status: Duplicate
Merged: issue 32865
Owner: ----
Closed: Feb 2015
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Sign in to add a comment

Issue 4505: javascript .select() method broken

Reported by, Nov 17 2008

Issue description

Chrome Version       : chromium build 5561
URLs (if applicable) :
Other browsers tested:
Add OK or FAIL after other browsers where you have tested this issue:
Safari 3:
    Firefox 3:ok
         IE 7:ok

What steps will reproduce the problem?
1. go to the link
2. type some text in 1 of the fields.
3. blur the field, then focus

What is the expected result?
text becomes selected onFocus

What happens instead?
text becomes selected onMouseDown and de-selected onMouseUp

Please provide any additional information below. Attach a screenshot if 

this happens with both my mouse and touchpad.
this also happens when i create a test html containing <input type="text" 
onFocus=";" /> and run it locally.

i'm running chromium on vista home premium 32-bit on an LG E-500 notebook.

Comment 1 by, Nov 20 2008

Labels: -Area-Misc Area-Compat webkit-specific Has-reduction report-to-webkit
Status: Untriaged
This is a webkit-specific issue. 
Reduced testcase can be found at: (or see attached file)
319 bytes View Download

Comment 2 by, Nov 21 2008

Labels: -Area-Compat Area-WebKit
Status: Assigned

Comment 3 by, Dec 5 2008

Labels: -report-to-webkit reported-to-webkit
Status: Upstream
Upstream bug:

Comment 4 by, Oct 6 2009

Labels: Mstone-X

Comment 5 Deleted

Comment 6 by, Jan 10 2010

I'm having this same exact problem on my website -

This is the code:

	converted.addEvent('focus', function(e) {;

converted refers to the bottom textarea box and when focused on, the text inside is
supposed to be selected. this works in firefox and ie, but not chrome or safari.

so to re-produce the bug, enter text in the top textarea box. then click on the
bottom textarea box. you'll notice that the text gets selected, and then de-selected.
does anyone know of a quick fix that can be implemented in JavaScript without writing
browser-specific code?

Comment 7 by Deleted ...@, May 21 2010

Using jquery, you can get around the problem by


Comment 8 by, Aug 6 2010

Status: ExternalDependency

Comment 9 by, Oct 2 2011

Has this bug eventually been fixed?

Comment 10 by, Nov 1 2011

Owner: ----

Comment 11 Deleted

Comment 12 by Deleted ...@, Feb 12 2012

Chrome 16 is still having this problem.

Comment 13 by, Mar 21 2012

Easy workaround: onmouseup="return false"

Comment 14 by, Apr 20 2012

The workaround sortof works. After clicking on the field, the text stays selected, but you cannot deselect the text with another click in between letters. If you want to deselect and edit the field you have to use the keyboard arrow keys to deselect first.

Comment 15 by Deleted ...@, May 9 2012

The ie works well. Why

Comment 16 by Deleted ...@, May 21 2012

A slightly better workaround might be this focus code:

var self = this;setTimeout(function() {;}, 0);

Comment 17 by Deleted ...@, Sep 19 2012

Thanks thetoolman, great solution!  The mouseUp workaround is just not feasible if you want to retain the ability to move the cursor inside the field with mouse clicks.  Your 0 delay timer works perfectly though!

Comment 18 by, Sep 27 2012

After a flood of complains in our apps, it's chrome fault.
This bug made our company change our recommended browser back to Firefox.

Comment 19 by Deleted ...@, Feb 6 2013

I'm having the same behavior/problem in Firefox 18.0.1 on Xubuntu 12.10

Comment 20 by, Mar 10 2013

Project Member
Labels: -Area-WebKit Cr-Content

Comment 21 by, Apr 6 2013

Project Member
Labels: -Cr-Content Cr-Blink

Comment 22 by, Feb 12 2015

Labels: -Cr-Blink Cr-Blink-Forms
Mergedinto: 32865
Status: Duplicate

Comment 23 by Deleted ...@, Jun 16 2015

many thanks @#16 thetoolman, it is ok.

Sign in to add a comment