What the component guarantees
- Handles are sliders. Each handle is
role="slider"in the tab order, witharia-valuemin,aria-valuemaxandaria-valuenow. A single slider is named by itslabel(aria-labelledby). In range mode the two handles are named "Minimum" and "Maximum", after the label when there is one, and each handle's bounds stop at the other's value, so the reader hears the real limits. - Validation a reader hears. With
error, each handle carriesaria-invalid="true"andaria-describedbypoints at the visible message by its id ({id}-error,{id}-warning,{id}-helper). A message present on load is read on focus; one that appears or changes later mounts withrole="alert"(error) orrole="status"(warning). - A visible focus ring. The single handle draws 2px of
--nb-c-focus-ring. A range handle is clipped to a triangle, which would clip its outline, so the track carries the ring while either handle has focus. - The companion field (
show-input) is anNbNumberInput, reachable and typeable. - Keys and validation tested in
tests/fieldValidationAria.test.ts, markup by axe intests/axe.test.ts(see the gap below).
Keyboard
| Key | Action |
|---|---|
| → ↑ | Up one step |
| ← ↓ | Down one step |
| Page Up / Page Down | Up or down ten steps |
| Home / End | To min or max |
What you own
- A
label. Without it a single handle has no name. - Units and meaning.
aria-valuenowis a bare number. If the value is a percentage, a price or a time, say so in the label ("Volume, percent"). - Not acting on every step. Keys emit
update:modelValueandchangeon every press. Debounce anything expensive.
Known gaps
- The companion number fields have no name. With
show-input, eachNbNumberInputbeside the track is rendered without a label, so a reader hears "spin button" alone. axe reports it, and it is the one entry intests/axe-baseline.json. Turnshow-inputoff, or label the slider so at least the handles are named, until it is fixed. - No
aria-valuetext, so a value with units is read as a bare number. - No manual screen reader pass has been recorded for this component.