Skip to main content

The <optgroup> Element

As defined in the HTML Living Standard, the <optgroup> element represents a group of <option> elements with a common label.

Visual Example:

<select> <optgroup label="Category Name"> <option>Option 1</option> <option>Option 2</option> </optgroup> </select> View HTML Living Standard: The optgroup element

Technical Requirements

WCAG Requirement: Info and Relationships

Success Criterion 1.3.1 (Level A): Information, structure, and relationships conveyed through presentation can be programmatically determined.

For long select lists, grouping related options is an essential usability and accessibility practice. Screen readers announce the group label when a user navigates into it, providing the necessary context to distinguish between identical or similar options (e.g., distinguishing "Springfield" in Illinois vs. "Springfield" in Massachusetts).

Understand SC 1.3.1: Info and Relationships

Cognitive Benefits

Long, unstructured lists are difficult for all users to process, but they are a major barrier for users with **cognitive or memory impairments**.

A11y Tip: Beyond the Group

If a select list becomes too large (e.g., hundreds of items), consider if a searchable autocomplete field (using <datalist>) or a multi-step selection process might be more accessible than a single massive dropdown.