Picto thématique

Rule n° 91 - The items in a drop-down list are grouped together appropriately, where applicable.

The content of some drop-down lists is sufficiently homogeneous to be sufficient in itself, but in some cases, the list will be easier to see by being better organized. In this case, the optgroup html element is your friend.

#Forms #Editorial #Accessibility

Goal

  • Allow technical aids to return a list to the user whose organization is clear to see; and that simplifies moving from one item on the list to another.
  • Foster the accurate rendering of complex drop-down lists in every browser.
  • Improve the accessibility of content for people with disabilities.

Implementation

Use the optgroup element to tag thematic groupings of option elements in select

lists.

Use the label attribute of the optgroup element to display the label for each grouping.

Control

For each drop-down list:

  • Open each (select) list to identify those which require a grouping of optionelements, for example grouping of car models by brands or grouping of cities by administrative area;
  • Verify, by examining the source code using Firebug, that each series of option elements that should be grouped is tagged with the optgroup element;
  • Check that each optgroup element has a label attribute associating a label relevant to the group of options in question.

By Opquast - Read the license