Onchange event not triggered in a <select> tag when using the keyboard arrow keys

RESOLVED DUPLICATE of bug 126379

Status

()

Toolkit
Form Manager
--
minor
RESOLVED DUPLICATE of bug 126379
13 years ago
9 years ago

People

(Reporter: Hercules Gunter, Assigned: Ben Goodger (use ben at mozilla dot org for email))

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7) Gecko/20040707 Firefox/0.9.2
Build Identifier: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7) Gecko/20040707 Firefox/0.9.2

When the displayed value of a dropdown list changes, the onchange event should
fire.  Mozilla does this if the mouse is used, or if the list is opened with
Alt+DownArrow and the new value selected with Enter, but not in response to
keyboard arrow keys, although the list is scrolled through correctly.

Reproducible: Always
Steps to Reproduce:
1. Create a dropdown list with onchange handler (just displaying the value would
be sufficient).
2. Scroll through the list with keyboard arrow keys (move the focus to the list
with Tab, then use Up/Down); the onchange handler does not fire.
3. Use the mouse to select, or Alt+Down to open the list then move to a new item
then press Enter; the onchange event handler fires.

Actual Results:  
With arrow keys, no onchange event.  With other selection methods, an onchange
event fires.

Expected Results:  
The onchange event handler should fire if the displayed text changes, however
the change is caused.

Presumably the event is firing when the list closes, and not when the text value
changes.

One can argue that alternative methods exist and that the issue is not
important.  For people with disabilities, the alternatives can be difficult for
them, and these people should not be ignored.

I can't give a URL; I'm developing an application not yet published and which
has security that prevents simple access via a URL.
onchange fires when you blur the element, by tabbing off (tab, down-arrow,
down-arrow, tab). It sounds like you are asking for it to fire after the first
down-arrow, which would be a nightmare: one of the most common uses of select
menus is for navigation, which in that case would only be possible by tab,
down-arrow, navigate to first option, back, tab, down-arrow, navigate to second
option, ...
Hardware: PC → All

Comment 2

13 years ago
Here is a small example which only works if you use mouse, not with keyboard. I
consider this as a real bug, it should be fixed before 1.0.

<html><body>
<form name="form">
<input type=text name="text"><br>
<select name="sel" onChange="document.form.text.value=this.value">
<option value=1>Value 1
<option value=2>Value 2
<option value=3>Value 3
</select>
</form>
</body></html>

IE fires onChange also if you change the value with keyboard, like it should be
and developers (like me) rely on that event.
Flags: blocking-aviary1.0?

Comment 3

13 years ago

*** This bug has been marked as a duplicate of 126379 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → DUPLICATE

Comment 4

13 years ago
(In reply to comment #1)
> onchange fires when you blur the element, by tabbing off (tab, down-arrow,
> down-arrow, tab). It sounds like you are asking for it to fire after the first
> down-arrow, which would be a nightmare: one of the most common uses of select
> menus is for navigation, which in that case would only be possible by tab,
> down-arrow, navigate to first option, back, tab, down-arrow, navigate to second
> option, ...

This is a pretty poor example, considering IE has the largest market share, and
fires onChange when the up/down arrows are used, and no one seems to have a
problem with the the way it works there. See bug #126379 -- it gives a lot of
reasons why Firefox should be acting more like Internet Explorer.

It amazes me that the FireFox/Mozilla team is ignoring this.

Updated

13 years ago
Flags: blocking-aviary1.0?
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.