liveBook · Manning

Tabbed interface

As explained in Architecting Accessibility

A tabbed interface is a composite user-interface pattern in which tabs control the visibility of corresponding content panels.

A tabbed interface shows one content panel at a time; selecting a tab reveals its panel and hides the others. Because HTML has no native tab element, custom tabs need accessible semantics and expected behavior—not ARIA alone. section 2.5.2

When implementing tabs:

  • Use semantic HTML first, then add ARIA roles, states, and properties to describe the custom tab list, tabs, and panels. section 2.5.2
  • Implement expected keyboard interaction and focus management; the example handles arrow keys, Home, End, and manual activation with Enter or Space. section 2.5.2
  • Consult the WAI-ARIA Authoring Practices Guide for behavior specifications and working patterns. section 2.5.2
Listing 2.2 Tabbed interface implemented in HTML, including ARIA attributes
...
<main>
  <section class="tabs">
    <!-- TABS -->
    <div role="tablist" #A
      aria-label="Product Specifications"
      id="specs-tabs">
        <button type="button" role="tab" #B
          aria-selected="true" #C
          aria-controls="panel-1" #D
          id="tab-1" 
          tabindex="0"> #E
            Overview
        </button>
        <button type="button" role="tab"
          aria-selected="false" 
          aria-controls="panel-2" 
          id="tab-2" 
          tabindex="-1"> #F
            Technical Specifications
        </button>
    </div>
    <!-- PANELS -->
    <div role="tabpanel" #G
      id="panel-1"
      tabindex="0" #H
      aria-labelledby="tab-1"> #I
        <p>
          This product is lovely, durable and designed for 
          something - not sure yet. Comes with a 25-year 
          all-in warranty.
        </p>
        <p>
          This is a <a href="#">focusable</a> element.
        </p>
        <img src="images/TabInterface.jpg" 
          alt="Close up of red object" 
          class="product_image" />
     </div>
     <div role="tabpanel" 
       id="panel-2" 
       tabindex="0"
       aria-labelledby="tab-2" 
       hidden> #J
         <ul>
           <li>Dimensions: 100 × 200 × 15mm</li>
           <li>Weight: 15Kg</li>
         </ul>
     </div>
   </section>
 </main> 
...

The markup example pairs tab and tab-panel roles with selection state, control relationships, and labeling. section 2.5.2

How Architecting Accessibility covers it

How deep it goes
Demonstrates tab markup, selection state, panel visibility, keyboard navigation, and focus management.
Examples
Shows product-specification tabs and keyboard handling for arrows, Home, End, Enter, and Space.
What it assumes
Starts with semantic HTML and adds ARIA when native elements do not provide the needed semantics.
What you can do after
Build it from scratch by applying ARIA semantics and implementing expected keyboard and focus behavior.
How it connects
Connects tabbed interfaces to semantic HTML, ARIA, keyboard interaction, and focus management.

This explainer was generated by Manning's knowledge graph from the text of Architecting Accessibility. The section links point to the parts of the book it draws on.