Bug 22691 - javascript .select() method doesn't work from onfocus
: javascript .select() method doesn't work from onfocus
Status: UNCONFIRMED
: WebKit
Forms
: 528+ (Nightly build)
: PC Windows XP
: P2 Normal
Assigned To:
: http://www.java2s.com/Code/JavaScript...
:
:
:
  Show dependency treegraph
 
Reported: 2008-12-05 12:50 PST by
Modified: 2012-11-24 08:21 PST (History)


Attachments
reduction (319 bytes, text/html)
2008-12-05 12:58 PST, Anantha Keesara
no flags Details


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-12-05 12:50:24 PST
Steps:
1. go to the link
2. type some text in 1 of the fields.
3. blur the field, then focus

Issue:
text doesn't get focused.

Other Browsers:
FF3, IE7: text gets focused.

Nightly tested:WebKit-r38794

Chromium bug: http://code.google.com/p/chromium/issues/detail?id=4505
------- Comment #1 From 2008-12-05 12:58:26 PST -------
Created an attachment (id=25784) [details]
reduction
------- Comment #2 From 2010-02-24 16:46:49 PST -------
I posted the following message on the code.google page (there's a link in Anantha's comment)... but it's been over a month and this bug doesn't seem to be getting any notice and has not been fixed. So I thought I'd copy my comment here to see if perhaps it'll get more attention.  Hope this can help developers to reproduce the bug and fix the issue.  It's not a huge bug, but it seems like a significant oversight.

I'm having this same exact problem on my website - http://www.upsidedowntext.com/

This is the code:

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

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 #3 From 2010-03-30 14:50:04 PST -------
To add some further clarification, the problem only occurs when the field gains the focus via a click. If you tab to the field the content is selected correctly.
------- Comment #4 From 2011-04-22 08:58:46 PST -------
*** Bug 23710 has been marked as a duplicate of this bug. ***
------- Comment #5 From 2012-11-24 08:21:37 PST -------
This bug report is over 8 years old, and still no one is fixing it?

I am a programmer my self, but before I can contribute may be some of the developers who knows the WebKit code base can help me to find out where to start?