Closed Bug 319326 Opened 20 years ago Closed 19 years ago

[FIX]Form <option> list javascript repopulate causes initial text to be blank

Categories

(Core :: Layout: Form Controls, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9beta1

People

(Reporter: mattsch, Assigned: bzbarsky)

References

Details

(Keywords: testcase)

Attachments

(3 files, 1 obsolete file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Focusing on an option list right after that list has been repopulated using javascript causes the initial text to be blank. It appears that that javascript sees the initial text and value of the first option, it is simply not painted on the screen properly. This bug also exists on Firefox 1.5 (winxp). Works as expected on Opera 8.51 and IE 6 SP2 (winxp). Reproducible: Always Actual Results: The list is repopulated but the first option text is blank. Expected Results: List should be repopulated and not create a "ghost" blank option.
It seems this was fixed and then somehow regressed? I did a little testing and on Seamonkey build 2005101005, the javascript repopulation works as expected but when I tested Seamonkey build 2005120508, the repopulation is broken again.
confirmed with linux seamonkey trunk 2005120604
Assignee: general → nobody
Status: UNCONFIRMED → NEW
Component: General → Layout: Form Controls
Ever confirmed: true
Keywords: testcase
OS: Windows XP → All
Product: Mozilla Application Suite → Core
QA Contact: general → layout.form-controls
Version: unspecified → Trunk
Attached patch Proposed fix — — Splinter Review
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #276155 - Flags: superreview?(mats.palmgren)
Attachment #276155 - Flags: review?(mats.palmgren)
Priority: -- → P2
Hardware: PC → All
Summary: Form <option> list javascript repopulate causes initial text to be blank → [FIX]Form <option> list javascript repopulate causes initial text to be blank
Target Milestone: --- → mozilla1.9 M9
Blocks: 330554
Though note also bug 330554. It seems to me that if we're coming from a selected index reset (whether scripted selectedIndex set, or when mSelectedIndex used to be -1) we should always update the display area, no?
Comment on attachment 276155 [details] [diff] [review] Proposed fix This would regress selectedIndex=-1 from script, hovering the dropdown would then auto-selects an option, which I think is not desired. The patch in bug 330554 looks good though, so I'll continue the discussion over there.
Attachment #276155 - Flags: superreview?(mats.palmgren)
Attachment #276155 - Flags: superreview-
Attachment #276155 - Flags: review?(mats.palmgren)
Attachment #276155 - Flags: review-
Hold on. What would regress, exactly? Bug 330554 testcase 3, which of the tests and what steps to reproduce?
I guess "onfocus= populate an empty select, and then set selectedIndex=-1" and then hover the list.... ok. This should be simple to address. Modified patch coming up.
Attached patch Fix that problem — — Splinter Review
Attachment #277581 - Flags: superreview?(mats.palmgren)
Attachment #277581 - Flags: review?(mats.palmgren)
Attached file Testcase #2 (obsolete) —
An improvement, but I still think something is fundamentally wrong with the way we handle selectedIndex. Here's a testcase to illustrate. (it's a subset of bug 330554 Testcase #3, with extra tracing) I don't think selectedIndex should change at all from just hovering - IE7, Opera9 and Safari/Webkit don't change it, only if you actually select something. This bug also occur in Firefox 2.
That's because nsHTMLSelectElement::OnOptionSelected always sets the selected index if the current one is < 0, even if the call is coming from the frame. Note that for a click in a listbox or combobox we _do_ want to do that. This code is a mess. :( In any case, that problem is somewhat separate from this bug...
Boris, sorry for being difficult, but do you have a testcase where the patch actually makes a difference? I tried a lot of different tests and I couldn't find a single one (now that bug 330554 is fixed).
Attachment #277618 - Attachment is obsolete: true
Ah, hmm. I guess SelectSomething calls SetSelectedIndex(), so this is in fact fixed by the checkin for bug 330554. Much better than trying to get the conditions here to be right. ;) Fixed by that patch; I'll try to write a test for this based on the initial testcase in this bug.
No longer blocks: 330554
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Depends on: 330554
Flags: in-testsuite?
Resolution: --- → FIXED
Attachment #277581 - Flags: superreview?(mats.palmgren)
Attachment #277581 - Flags: review?(mats.palmgren)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: