Tabs

2 Tabs variations from the W3C ARIA Authoring Practices Guide.

Tabs (Automatic)

A set of related panels with automatic tab activation.

Corresponding W3C APG example

Example

Plan a weekend by the sea.
Take the train on Friday.
Stay near the old harbor.

Keyboard interaction

Arrow keys select and focus tabs. Home and End reach the ends. Tab enters the active panel.

Events

Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.

  • axxy-tab-change — Dispatched when the active tab changes. (target: Selected [role="tab"], detail: { tab: HTMLElement, panel: HTMLElement })

Events reference and examples

Example HTML

<axxy-scope>
  <section>
    <div role="tablist"  aria-label="Trip details">
      <button>Summary</button>
      <button>Travel</button>
      <button>Stay</button>
    </div>
    <div>Plan a weekend by the sea.</div>
    <div>Take the train on Friday.</div>
    <div>Stay near the old harbor.</div>
  </section>
</axxy-scope>

Tabs (Manual)

A set of related panels with manual tab activation.

Corresponding W3C APG example

Example

Plan a weekend by the sea.
Take the train on Friday.
Stay near the old harbor.

Keyboard interaction

Arrow keys move focus; Enter or Space selects a tab. Home and End reach the ends.

Events

Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.

  • axxy-tab-change — Dispatched when the active tab changes. (target: Selected [role="tab"], detail: { tab: HTMLElement, panel: HTMLElement })

Events reference and examples

Example HTML

<axxy-scope>
  <section>
    <div role="tablist" class="manual" aria-label="Trip details">
      <button>Summary</button>
      <button>Travel</button>
      <button>Stay</button>
    </div>
    <div>Plan a weekend by the sea.</div>
    <div>Take the train on Friday.</div>
    <div>Stay near the old harbor.</div>
  </section>
</axxy-scope>