Picker dialog
The modal form of a date or time picker, with confirm, dismiss and mode-toggle slots.
import { PickerDialog } from '@windmorph/react';Keyboard
| Key | Action | Where |
|---|---|---|
| Tab or Shift + Tab | Moves through the picker and the actions, staying inside the dialog. | |
| Escape | Closes the dialog without calling onConfirm. | |
| Enter | With onConfirm, Enter on a day (or in a typed date) selects it, then closes the dialog and saves. onConfirm runs once the picker's new value has rendered. A range saves once both ends are picked.In a date picker | In a date picker |
The picker inside keeps its own keys: see DatePicker and TimePicker.
Screen reader
- Role
dialog, modal (React AriauseModalOverlayanduseDialog): the rest of the page is hidden from assistive tech while it is open.- Accessible name
- The required
aria-labeloraria-labelledby: the types reject a dialog with neither. In the time variant atitlealso names it. - States announced
- None of its own; the picker inside announces its value.
- The scrim is decorative (
aria-hidden). - The actions read in order:
modeToggleButtonat the start, thendismissButtonandconfirmButtonat the end. Full screen, a close (x) button namedlabels.close("Close") comes first and the Save button (labels.save) last.
Focus
- Opening it moves focus into the dialog; the docked or modal picker inside then focuses its selected day where it does so. Focus is contained while it is open and returned to what opened it when it closes.
- While it animates out, focus is no longer contained.
Touch target
- The actions are your buttons; text and icon buttons have 48 × 48px targets. The full-screen close (x) button is an icon button with a 48 × 48px target.
- A press outside the panel closes the dialog while
closedByis"any"(the default), so the scrim is one large target.
Motion
Under reduced motion both transitions (reveal and scale) keep only their fades: the dialog doesn't slide, grow or scale.
What you need to do
- Name the dialog for what it picks (
aria-label="Select date"), or pointaria-labelledbyat a visible title. - Pass a dismiss button as well as the confirm button, so leaving without saving is one obvious action and not only Escape or a press outside.
- Use text buttons for the actions, as M3 does, and translate
labelsfor the full-screen close and Save buttons.