Closed Bug 166829 Opened 20 years ago Closed 20 years ago

Keyboard JS onchange event in select boxes not fired?


(Core :: DOM: UI Events & Focus Handling, defect)

Windows NT
Not set



CLOSED DUPLICATE of bug 126379


(Reporter: swunderlin, Assigned: joki)


Discovered in Mozilla 1.1 final on Windows NT4 SP5 (other platforms untested):

having discovered that an onchange event in a select box is not fired. This only
happens if the chackbox is changed via keyboard (mouse works fine).


	<select name="blah" 
		<option value="1">1
		<option value="2">2
		<option value="3">3
It fires fine.  It just fires when the value has actually _changed_ (ie when the
<select> loses focus), not while the user is scrolling through the select with
keyboard looking for the right value.
i might have been a bit unprecise. When selecting with the keyboard the onchage
seems to behave like the onblur event.

This is not the case when using the mouse (where onchange is actually fired when
another <option> is selected).
This is needed to allow keyboard users to scroll through the select without
triggering onchange when all they're doing is getting to the option they want. 
See bug 110800

*** This bug has been marked as a duplicate of 126379 ***
Closed: 20 years ago
Resolution: --- → DUPLICATE
Note also the definition of "onchange" in the HTML spec:

  The onchange event occurs when a control loses the input focus and its value has
  been modified since gaining focus. This attribute applies to the following
  elements: INPUT, SELECT, and TEXTAREA.

It's like firing onchange for every char typed in a text input...
Thank you for clarifiying this. I was confused due to that fact that Netscape
4.X and all IE's do not act like this.
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.