Bug 22691 - javascript .select() method doesn't work from onfocus
Summary: javascript .select() method doesn't work from onfocus
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL: http://www.java2s.com/Code/JavaScript...
: 23710 (view as bug list)
Depends on:
Reported: 2008-12-05 12:50 PST by Anantha Keesara
Modified: 2012-11-24 08:21 PST (History)
6 users (show)

See Also:

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 Anantha Keesara 2008-12-05 12:50:24 PST
1. go to the link
2. type some text in 1 of the fields.
3. blur the field, then focus

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 Anantha Keesara 2008-12-05 12:58:26 PST
Created attachment 25784 [details]
Comment 2 Venkat Koduru 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) {

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 Ivan Peters 2010-03-30 14:50:04 PDT
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 Alexey Proskuryakov 2011-04-22 08:58:46 PDT
*** Bug 23710 has been marked as a duplicate of this bug. ***
Comment 5 Terje 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?