bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

Combobox selectedIndex changes when hovering options in the dropdown menu




Layout: Form Controls
11 years ago
4 years ago


(Reporter: mats, Unassigned)


(Blocks: 2 bugs, {compat, testcase})

compat, testcase
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)



(1 attachment)



11 years ago
(spawned off from bug 307339 comment 10/11 and 319326 comment 10)

Combobox selectedIndex should not change at all from just hovering options
in the dropdown menu - IE7, Opera9 and Safari/Webkit don't change it,
only if you actually select something.  This bug also occur in Firefox 2.

1. click on the combobox
2. hover the options in the dropdown menu

selectedIndex should not change in 2.

(its value is logged in the textbox with 1 sec intervals)

1. click on the combobox
2. press UP/DOWN keys

Again, selectedIndex should not change in 2.

selectedIndex should reflect the selected value for the combobox,
it should not change until the user clicks on an option or press RETURN

Whether or not the displayed value in the combobox should change in
the keyboard case in another matter.  IE7 does change it; Opera doesn't;
Hard to say what Safari does since the dropdown covers the combobox
but I'm guessing it doesn't change based on the check mark on
the currently selected option in the menu (which does not change).

Comment 1

11 years ago
Created attachment 277995 [details]
I think we need some serious automated regression tests before we tackle this....

Comment 3

9 years ago
This seems intentional from this comment in nsComboboxControlFrame.cpp. Does anyone know why?

657 // In dropped down mode the "selected index" is the hovered menu item,
658 // we want the last selected item which is |mDisplayedIndex| in this case.
You could look at the CVS blame, right?


8 years ago
Duplicate of this bug: 554732
Would someone confirm that this bug is indeed a bug and that we are not following the html spec?
Someone on Angular.js github issue tracker told me this issue would relate to my issue I was facing. Please see https://github.com/angular/angular.js/issues/3753#issuecomment-27491232
Flags: needinfo?

Comment 7

5 years ago
Quote from the html spec: "Upon this option element being picked (either through a click, or through unfocusing the element after changing its value, or through a menu command, or through any other mechanism) ... [the value should be changed]". Hovering between options with the mouse, causes the option you just left to be assigned as the selectedIndex. It also happens when moving from an option off to space outside. In both cases, you are not 'selecting an item' via a click. Using the keyboard and tabbing away it would make sense to update the index as focus moves, but this behavior with mouse movement is silly. For example, if the user clicks a select and moves their mouse down to select the last of 10 options, 9 different changes to the selectedIndex will be made even though the user hasn't really 'selected' anything until they click on the option they were going for. Passing their mouse over options on the way to the one they want to click on doesn't constitute "changing its value". This behavior makes it impossible for me to get my application working as I want in Firefox.

Comment 8

5 years ago
I should also mention that when the selectedIndex is changed this way, for example by hovering over an option and then clicking somewhere else on the page without selecting anything with the mouse, the option shown in the select is not changed, and the option that will be sent via a form submission is not changed, and javascript change events aren't fired, but the 'selected index' is changing? That is self-contradictory. Clicking outside of the select instead of on an option is intuitively a 'nevermind I don't want to select anything' action.


5 years ago
Flags: needinfo?

Comment 9

5 years ago
Turns out rendering differences in other browsers are also causing problems, so I'm abandoning my approach entirely and this bug fix will no longer affect me.
Duplicate of this bug: 1039047
You need to log in before you can comment on or make changes to this bug.