SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Feb 2003
    Location
    eez
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is it bad to have <select> elements outside of a form? (accessibility)

    Hi!

    Is it bad to have <select> elements outside of a form?

    I mean when you select option from the select some javascript redirects you somewhere! No form needed for this!

    Need advice from an accessibility standpoint.

    Thanks

  2. #2
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do you expect it to work without JS?
    Simon Pieters

  3. #3
    SitePoint Member
    Join Date
    Dec 2006
    Location
    San Diego, CA - USA
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    -agw

    Yes and No... you have to consider what standard you are coding by, and how deep you want to get into accessibility.

    According to XHTML 1.1, you must place a <select> tag inside a <form> ... </form>. That is simply a coding standard the W3C established.

    From an accessibility PoV, you should still nest your <select> inside a form, just to give the browser a heads up... but if you really want your site to be as versitile as possilbe (as far as accessibility is conserned), JavaScript navigation is not the way to go as certain browsers will have problems reading and interpreting your JavaScript for people with disabilities.

    Hope that helps.

    -Josh

  4. #4
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by enigmadd View Post
    According to XHTML 1.1, you must place a <select> tag inside a <form> ... </form>. That is simply a coding standard the W3C established.
    Err... no, XHTML 1.1 is the same as XHTML 1.1 and HTML 4.01 in this regard.

    It's not the fact that you place a <select> outside <form> that is important here. That is allowed but seemingly meaningless. What's important here is whether you rely on JavaScript or not. (You can use JS as much as you like, so long as you make sure you get the same content and functionality without JS, e.g. by falling back to server side scripts or something.)
    Simon Pieters


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •