The @role attribute and the DIV/SPAN elements.

 Good evening.

  As I have, in the past, expressed I am somewhat uncertain as to the
  use of the role-attribute in XHTML (and HTML). It is my worry that it
  will be misused, and lead to decreased accessibility.

  As we are all aware, it is important - for all user groups - that
  content is marked up according to its nature. This is the very concept
  of "generic coding", and has been in the forefront of markup languages
  since the 1960ies.

  It is, when push come to shove, not that important whether semantics
  are encoded using elements or attributes - what /is/ important is that
  we agree on how to parse, and how to interpret, the information in
  question.

  We could even take this as far as saying that it isn't even important
  whether we agree on which semantic tidbits we can mark up, as long as
  each piece of information can be reliably mapped to a different piece
  of information which /is/ understood.

  The @role attribute is meant as a means to enhance the semantic value
  of existing elements, or as the XHTML Role Working Draft state:

     "The XHTML Role Attribute defined in this specification allows
      the author to annotate XML Languages with machine-extractable
      semantic information about the purpose of an element."

  While this is a paradigm shift - there is already machine-extractable
  semantic information in the elements themselves - it can be a useful
  enhancement -- if it is used to /enhance/, and not introduce new
  semantics. For instance, the following construct will aid UAs in
  determining the purpose of the element:

   <ul role="wairole:menu">
   </ul>

  An UA understanding the wairole:menu role can handle the list as a
  menu, while an UA not understanding that role can treat it as a list
  of links.

  The Aria Roadmap, however, has the following example:

        <div role="wairole:menu">
            File
        </div>

  which, while the above is meant to create a 'File control' (a GUI
  object), neatly illustrate the problem. The DIV element
  - capitalized for ease of reading - has no predefined semantic
  meaning, and hence the role attribute as used actually /create/
  semantics where none existed in the past. A UA not supporting this
  role can only fall back to an empty, semantically void, element.



  It is my suggestion, therefore, that the role attribute should NOT be
  allowed on the DIV and SPAN elements in XHTML 2 in order to encourage
  best practice, and rather be reserved for elements with acknowledged
  semantic interpretation as fallback content.

-- 
 -  Tina Holmboe      Developer's Archive           Greytower Technologies
                   http://www.dev-archive.net      http://www.greytower.net    

Received on Tuesday, 21 August 2007 15:59:43 UTC