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.

#Accessibility #Development #Editorial #Forms

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


Discover Opquast training and certification

The objective of these rules and the Opquast community mission is ‘making the web better’ for your customers and for everyone! Opquast rules cover the key major areas of risk that can negatively affect website users such as privacy, ecodesign, accessibility and security.

Opquast training has already allowed over 19,000 web professionals to have their skills certified. Train your teams, contact us

We offer a 1 hour free discovery module.