# Test — Header Flight Dropdown a11y

**Task**: AZ-468_test_header_dropdown
**Name**: Header flight dropdown — closed/open a11y + Escape handler
**Description**: Implement the 3 blackbox tests pinning the header flight dropdown's open/closed-state a11y attributes and the Escape-to-close handler-detachment behavior.
**Complexity**: 2 points
**Dependencies**: AZ-456_test_infrastructure
**Component**: 10_app-shell (Header) (Blackbox Tests)
**Tracker**: AZ-468
**Epic**: AZ-455

## Problem

The header dropdown is keyboard-traversed dozens of times per session; an a11y regression makes the app unusable for keyboard / screen-reader users. The Escape handler must detach on close — a leak that hijacks Escape elsewhere.

## Outcome

- 3 scenarios pass.

## Scope

### Included

| Scenario | Profile | Source file |
|----------|---------|-------------|
| FT-P-30 — header flight dropdown closed-state a11y | fast | blackbox-tests.md |
| FT-P-31 — header flight dropdown open-state a11y | fast | blackbox-tests.md |
| FT-N-09 — header dropdown Escape — close + handler detached | fast | blackbox-tests.md |

### Excluded

- Flight selection logic itself (covered in 08_test_flight_selection_persistence).

## Acceptance Criteria

**AC-1: Closed state**
`aria-expanded="false"`; trigger has accessible name; no `aria-activedescendant`.

**AC-2: Open state**
`aria-expanded="true"`; `role="listbox"` (or `menu`); option list has roles; `aria-activedescendant` points to a real id.

**AC-3: Escape detach**
After Escape closes the dropdown, the document-level Escape handler installed by the dropdown is removed (tracked via `addEventListener` / `removeEventListener` spies). No leakage into other components' Escape handlers.

## System Under Test Boundary

- System under test: `<Header>` flight dropdown + Escape handler.
- Allowed stubs: MSW for flights list endpoint.
- Disallowed: reading dropdown React state.
- Expected observables per `results_report.md` rows for FT-P-30, 31, FT-N-09.
