Style Sheets
  Home arrow Style Sheets arrow Page 3 - Taming the Select
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

Taming the Select
By: Chris Heilmann
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 16
    2004-11-15

    Table of Contents:
  • Taming the Select
  • DOM to the rescue
  • But wait, there is more!
  • The Script

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    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.

    More Style Sheets Articles
    More By Chris Heilmann


       · I would be glad to get any feedback from Mac users on this technique, as I cannot...
       · As far as I remember Mac Firefox didn't have a problem.The problem I have with...
     

    STYLE SHEETS ARTICLES

    - Improving the Visual Presentation of a CSS D...
    - Fixing Browser Incompatibilities in a CSS Dr...
    - Building Clean Drop-Down Menus with CSS
    - Creating Hybrid Web Page Layouts with Negati...
    - Creating Three-Column Web Page Layous with N...
    - Swapping Column Positions in Web Page Layout...
    - Creating Web Page Layouts with Negative Marg...
    - Creating Gradients for Individual Containers...
    - Creating Gradients for Web Page Headers with...
    - SEO Scrolling Frames Problem Solved
    - Building Cross-Browser Background Effects wi...
    - CSS: Pseudo
    - Using PNG Images to Build Background Effects
    - CSS: Continuing the Clarification of CSS Cla...
    - CSS: Top Secret Classification






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT