Taming the Select - But wait, there is more!
(Page 3 of 4 )
Another reoccurring requirement by clients are SELECT navigations.
SELECTs are nice for navigation; they don't take up much screen estate and can be extended and reduced easily without shifting the other content out of the visible screen area.
We can create a perfectly accessible navigation with a select, if only we offer a non-JavaScript fall-back and a button to submit the form.
Alas, design restrictions and requirements by the client might force for us to get rid of the button. This means that users without JavaScript cannot submit the form any longer, which also renders our backend fall-back useless. To navigate, we need to use JavaScript called via an onchange handler on the select.
If we use the keyboard for navigation and we tab to the select, some browsers will try to navigate to the next option immediately when we hit arrow down. Experienced keyboard users will know though that you have to hit alt+arrow down first to expand the whole drop-down.
We can point these problems out to the clients, but chances are that we cannot persuade them to comply with our idea of the need for "that ugly button". They saw (or even created) the design and this is exactly how it should look like, for good or for worse.
Reversing the thinking process
We need to ensure that the select without the button only appears when JavaScript is available. Furthermore, we don't want to use a fall-back solution on the backend, as it means double maintenance, and we might not be able to offer it.
What we can do is use DOM to take a perfectly accessible and semantically clean navigation like a list of links, and turn it into a SELECT navigation when JavaScript is available.
This is also covered by the example script. If you look at the source of the example page, you see that the list of links with the class turnintoselect is turned into a SELECT navigation.
The script was tested on Internet Explorer 5, 5.5, 6, Opera 7.5 and Firefox 0.9 on windows. You can download it together with the demo page and see where else it can perform its magic.
Next: The Script >>
More Style Sheets Articles
More By Chris Heilmann