Bug 11447

Summary: REGRESSION(NativeListBox): List not scrolled to preselected option
Product: WebKit Reporter: Matt Lilek <dev+webkit>
Component: FormsAssignee: Antti Koivisto <koivisto>
Status: RESOLVED FIXED    
Severity: Normal CC: KwhiteRight, mitz, sam
Priority: P1 Keywords: HasReduction, InRadar, Regression
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
testcase
none
Scroll list to initial position if needed
mjs: review-
initiate scroll from insertedIntoDocument to cover dynamic cases too
darin: review-
updated patch darin: review+

Matt Lilek
Reported 2006-10-28 21:36:00 PDT
The scrollbar in the new list boxes default to the very top despite the inital selection being farther down among the options. When you load the testcase, the scroll position should be about halfway down. The correct item is selected and displayed, but the scrollbar is all the way at the top. Also, when the list box loses focus, it jumps back to default selection (scroll all the way to the bottom then click outside).
Attachments
testcase (1.75 KB, text/html)
2006-10-28 21:37 PDT, Matt Lilek
no flags
Scroll list to initial position if needed (35.03 KB, patch)
2007-02-21 09:57 PST, Antti Koivisto
mjs: review-
initiate scroll from insertedIntoDocument to cover dynamic cases too (41.37 KB, patch)
2007-02-22 06:28 PST, Antti Koivisto
darin: review-
updated patch (66.90 KB, patch)
2007-02-22 11:17 PST, Antti Koivisto
darin: review+
Matt Lilek
Comment 1 2006-10-28 21:37:11 PDT
Created attachment 11272 [details] testcase
Matt Lilek
Comment 2 2007-01-26 12:46:43 PST
A few things have changed since this was originally filed (as of r19135): (In reply to comment #0) > The scrollbar in the new list boxes default to the very top despite the inital > selection being farther down among the options. This still happens and is the current behavior. > The correct item is selected and displayed, but the scrollbar is all the way at > the top. This no longer happens. The selected item isn't displayed, the list box is positioned all the way at the top, completely ignoring the selected option, though it is properly selected when scrolling through. > Also, when the list box loses focus, it jumps back to default > selection (scroll all the way to the bottom then click outside). This also no longer happens.
Matt Lilek
Comment 3 2007-01-26 12:47:48 PST
Sam Weinig
Comment 4 2007-02-14 17:59:54 PST
Are we sure this is a bug? Firefox exhibits the same behavior as ToT.
Matt Lilek
Comment 5 2007-02-14 18:56:28 PST
(In reply to comment #4) > Are we sure this is a bug? Firefox exhibits the same behavior as ToT. > For me, Firefox exhibits the same behavior as Safari 2.0.4 while ToT ignores the pre-selected option in the testcase.
Antti Koivisto
Comment 6 2007-02-21 09:57:54 PST
Created attachment 13299 [details] Scroll list to initial position if needed Also ensure that item list is up to date after attach();detach(); changes renderer from listbox to menulist (this is needed along with the other change to prevent a layout test failure).
Maciej Stachowiak
Comment 7 2007-02-22 02:23:44 PST
Depending on closeRenderer is always a bit suspicious since it only gets called by the parser, and not in the dynamic construction case. If you construct a <select> element via pure DOM calls, do we still do the right thing?
Maciej Stachowiak
Comment 8 2007-02-22 05:03:24 PST
Comment on attachment 13299 [details] Scroll list to initial position if needed Per discussion with Antti, this also needs code to handle a dynamically constructed select element.
Antti Koivisto
Comment 9 2007-02-22 06:28:36 PST
Created attachment 13314 [details] initiate scroll from insertedIntoDocument to cover dynamic cases too
Darin Adler
Comment 10 2007-02-22 08:23:09 PST
Comment on attachment 13314 [details] initiate scroll from insertedIntoDocument to cover dynamic cases too I'd like to see the test case cover all three of the code paths. The ChangeLog doesn't mention the new HTMLOptionElement files in this patch. + HTMLSelectElement* select = 0; No reason to initialize this to 0. +//sel.setAttribute('selected','selected'); Is this commented out intentionally? This is pretty good, but I'm going to review- it since the ChangeLog and test case don't match the code.
Antti Koivisto
Comment 11 2007-02-22 11:17:18 PST
Created attachment 13321 [details] updated patch - fixed ChangeLog - cleaned up testcase - added tests for size=1 (MenuList) case too - removed unnecessary = 0
Darin Adler
Comment 12 2007-02-22 11:34:46 PST
Comment on attachment 13321 [details] updated patch r=me
Antti Koivisto
Comment 13 2007-02-22 12:10:29 PST
Note You need to log in before you can comment on or make changes to this bug.