RESOLVED FIXED 8743
REGRESSION: focus() on input field selects all text within it (was: cannot select cities on British Rail reservation site)
https://bugs.webkit.org/show_bug.cgi?id=8743
Summary REGRESSION: focus() on input field selects all text within it (was: cannot se...
Hanspeter Schaub
Reported 2006-05-04 15:19:56 PDT
REGRESSION On the British Rail reservation system I can no longer select cities in the departure/arrival text fields. As you start typing a city name there, the web page provides you with all possible cities that match your letters types. However, with the latest safari build (5/4/06) the latest letter typed is always used as the first letter? In the regular version of Safari that comes with 10.4.6 this does not occur. Here if you start typing a city, after each letter your possible selections are reduced until you select a specific city.
Attachments
Test case (602 bytes, text/html)
2006-05-05 11:33 PDT, jonathanjohnsson
no flags
patch (937 bytes, patch)
2006-05-09 22:54 PDT, Darin Adler
adele: review+
jonathanjohnsson
Comment 1 2006-05-05 11:33:57 PDT
Created attachment 8126 [details] Test case When the Javascript function focus() is run on an input field, it not only focuses the field, but selects all the text. This regression happened between nightlies r13568 and r13574.
Darin Adler
Comment 2 2006-05-06 12:00:29 PDT
What is focus() supposed to do, selection-wise? What does it do in other browsers? Is the selection supposed to go at the end of the field?
Darin Adler
Comment 3 2006-05-09 09:15:14 PDT
I think the issue is only when focus() is called on a field that's already focused. I'm guessing the behavior of selecting all is fine when the field doesn't already have focus. The problem is in HTMLInputElement::focus, which calls select() unconditionally and instead should call it only if the focus node is not already set.
Darin Adler
Comment 4 2006-05-09 22:54:30 PDT
Adele Peterson
Comment 5 2006-05-10 00:41:41 PDT
Comment on attachment 8198 [details] patch I think the AppKit controls maintain some state for their selection. In the future, we want to restore some of that state when we focus.
Darin Adler
Comment 6 2006-05-11 10:42:35 PDT
Committed revision 14301.
Note You need to log in before you can comment on or make changes to this bug.