Seat

Accessibility

Seat

NameTypeDescription
aria-labelledbystringId(s) of elements that announce the component to screen readers.
titlestringAdds the title attribute to the rendered SVG element. Announced by screen readers after the aria-labelledby element(s).
descriptionstringAdds the description attribute to the rendered SVG element. Announced by screen readers after the title value.

SeatLegend

Automatic Accessibility Features

  • The component automatically manages ARIA attributes:
    • Uses aria-pressed to communicate the selection state of the seat
    • Sets aria-disabled="true" for unavailable seats
    • Combines aria-labelledby, title, and description for comprehensive screen reader announcements
  • Focus management is handled automatically:
    • Seats with onClick function are rendered as interactive buttons with proper focus indicators
  • State management is handled automatically:
    • Selected state is visually indicated with a highlight
    • Unavailable seats have distinct styling to indicate they cannot be selected

Best Practices

  • Always provide either title, aria-labelledby, or both to ensure seats have accessible names.
  • Include meaningful description for seats with special characteristics (like extra legroom).
  • Consider adding an explanation of seat types using the SeatLegend component.

Keyboard Navigation

  • Tab: Moves focus between interactive (available) seats
  • Space/Enter: Selects or deselects the focused seat
  • Focus order should follow a logical pattern, typically left-to-right and top-to-bottom

Examples

Basic Seat with Accessibility Labels

<p id="l1" style={{ display: "none", visibility: "hidden" }}>
For passenger John Doe
</p>
<Seat
aria-labelledby="l1"
title="Seat 1A"
description="Extra legroom"
label="25€"
/>

Selected Seat with Price

<Seat
title="Extra legroom seat 1C"
description="Aisle seat with extra legroom"
type="legroom"
selected
price="€15"
onClick={() => handleSeatSelection("1C")}
/>

Unavailable Seat

<Seat title="Seat 24B already occupied" type="unavailable" />

Using External Labels

<div>
<span id="seat-label" className="sr-only">
Exit row seat 15F
</span>
<span id="seat-desc" className="sr-only">
Extra legroom, additional responsibilities
</span>
<Seat
type="legroom"
aria-labelledby="seat-label seat-desc"
onClick={() => handleSeatSelection("15F")}
/>
</div>

Seat Legend with Accessibility Label

<div>
<Seat
type="legroom"
title="15F"
description="Window seat"
aria-labelledby="legend"
onClick={() => handleSeatSelection("15F")}
/>{" "}
<SeatLegend
id="legend"
type="legroom"
label="Extra legroom"
aria-label="This seat has extra legroom"
/>{" "}
</div>