Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML select onchange accessibility concerns

We have a request to use a select element's onchange to trigger a move to a new page.

In the past, web accessibility literature I've read has generally advised against doing this. This was on the grounds that it breaks user expectation, and browsers (particularly IE < 6) fired the change event even when moving through options with the keyboard, making it impossible for keyboard-only users to make a selection.

IE6+ and all other more modern browsers I have tested fire the select onchange when an option is actually selected by mouse or enter key. Analytics for the application in question show that earlier IE browsers are essentially eradicated (< 0.01%)

Given that our users will be able to operate these select elements properly with a keyboard only, should this feature still be considered an impediment to accessibility? This behavior seems so common nowadays that I wonder also if it really still does break user expectation in a meaningful way?

EDIT: IE behaves differently if the select is focused with the mouse or keyboard. When focused with the mouse, keyboarding through options does not fire onchange but when tabbing to focus it via keyboard, the onchange does fire when arrowing through.

like image 775
Michael Berkowski Avatar asked Feb 23 '11 18:02

Michael Berkowski


1 Answers

Using the onchange event of the select element to navigate between pages can definitely pose an accessibility problem for keyboard-only users.

There is at least one method of creating accessible select elements with onchange handlers and it has been on the interwebs since 2004!

Direct link to the Accessible Select code.

like image 105
Chris Shouts Avatar answered Oct 24 '22 07:10

Chris Shouts