onchange event not triggered when used on combo with keyboard on <select> tags

VERIFIED DUPLICATE of bug 126379

Status

()

Firefox
General
VERIFIED DUPLICATE of bug 126379
12 years ago
12 years ago

People

(Reporter: cjubugfix, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.7.10) Gecko/20050717 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.7.10) Gecko/20050717 Firefox/1.0.6

<select name=age size=1  onchange="test()">
  <option selected>0 to 59 years</option>
  <option>60 to 79 years</option>
  <option>80 years or more</option>
</select>

with test beeing for example:

function test() { window.alert("yo"); }

Reproducible: Always

Steps to Reproduce:
1. write a simple select form (cf details)
2. connect then onchange event to a simple javascript for example
3. focus the combo and move up and down with th keyboard, the script is not
called. It works on IE though !



Expected Results:  
event onchange must be triggered (like in IE) (I think)

Comment 1

12 years ago
I do not think this is an FF bug, but an IE bug. From the W3C specification:

onchange = script [CT]
    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 is a little bit odd though, that selecting an option from the dropdown with
the mouse does trigger the onchange event. In my reading of the above
specification, this should not happen until the control loses the focus.
This is also the case when pressing "Enter" in the control: the focus is not
lost but the onchange event is triggered. I do not think this is correct.

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

Comment 3

12 years ago
(In reply to comment #0)
> User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.7.10) 
Gecko/20050717 Firefox/1.0.6
> Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.7.10) 
Gecko/20050717 Firefox/1.0.6
> <select name=age size=1  onchange="test()">
>   <option selected>0 to 59 years</option>
>   <option>60 to 79 years</option>
>   <option>80 years or more</option>
> </select>
> with test beeing for example:
> function test() { window.alert("yo"); }
> Reproducible: Always
> Steps to Reproduce:
> 1. write a simple select form (cf details)
> 2. connect then onchange event to a simple javascript for example
> 3. focus the combo and move up and down with th keyboard, the script is not
> called. It works on IE though !
> Expected Results:  
> event onchange must be triggered (like in IE) (I think)

(In reply to comment #2)
> *** This bug has been marked as a duplicate of 126379 ***

Thank you for replying so fast... From the specification you've mailed I have 
the same reading than you and I am also troubled by the difference of behavior 
using the mouse or the keyboard. I should have checked the specification 
before to mail this "bug" report sorry. 
Still, if you specify a size > 1 in the <select> the combo is replaced by a 
list and in this case, the onchange event is triggered each time a new item in 
the list is selected (mouse or keyboard) and not when the list loses focus AND 
the selection has changed... So with the same code, just changing the way the 
select is displayed (changing the control) the behaviour changes and this, I 
think, is a problem.

By the way, I also tried the same code with Konqueror and the behaviour is the 
same than with IE
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---

Comment 4

12 years ago
That doesn't make this bug not a dup of bug 126379.

*** This bug has been marked as a duplicate of 126379 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago12 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.