<div class="gmail_quote">On Wed, Oct 29, 2008 at 11:32 PM, Garrett Smith <span dir="ltr"><<a href="mailto:dhtmlkitchen@gmail.com">dhtmlkitchen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d">Ian Hickson wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, 6 Jun 2007, Sander wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The specs say that for <select> "...the change event shall be fired when the selection is completed...". Does this mean that, when using a keyboard for navigation, the change event is fired when the user hits 'enter' or when she navigates from one option to another? I assume it's the former, but I just to be sure as selectboxes with change event handlers are often (ab)used for navigation purposes. So, can anyone confirm my assumption? Thanks.<br>

</blockquote>
<br>
</blockquote></div>
The HTML 4 specification[1] says:<br>
<br>
| The onchange event occurs when a control loses the input focus and its<br>
| value has been modified since gaining focus.<br>
<br>
A "test case"[2] I found does expects that onchange fires when the select has been changed and while it still has focus.<br>
<br>
| Procedure<br>
|   1. Using the keyboard or an assistive technology that emulates the<br>
| keyboard, move focus to the select control.<br>
|   2. Using the keyboard or an assistive technology that emulates the<br>
| keyboard, select a value from the menu to trigger the onChange event.<br>
<br>
[example]<br>
<br>
| Expected results<br>
|<br>
|   1. A star colored according to the select option value appears when<br>
| the onchange event is triggered.<br>
<br>
Firing onchange before the select loses focus does not follow the HTML specification but is more useful and is what browsers mostly do.<br>
<br>
Often, a select is used to trigger another action, such as showing more fields in a form. The user chooses an option and, based on the selection, a section of the form is shown. If the change event does not fire when the item is chosen, the callback will not be called and the user will not see the event until he changes focus by tabbing or clicking away.<br>

<br>
Instead, the chagne event should (ideally) fire when a different option has been selected.</blockquote><div><br></div><div>Goodness no.  <select>s firing their onChange when different options are selected are horrifying for keyboard navigation.  You ever been to a site that uses a select and an onChange handler to do some quick navigation?  It becomes impossible to use the keyboard as intended, because the very first option that comes up when you use your arrow keys or type part of the name triggers the navigation.</div>
<div><br></div><div>Waiting until they lose focus is very slightly clumsy in some uses for users with a mouse, but it's a necessity for alternate input devices like a keyboard.</div><div><br></div><div>~TJ </div></div>