Skip to content

Picker dialog

The modal form of a date or time picker, with confirm, dismiss and mode-toggle slots.

import { PickerDialog } from '@windmorph/react';

Keyboard

Picker dialog keyboard
KeyAction
Tab or Shift + TabMoves through the picker and the actions, staying inside the dialog.
EscapeCloses the dialog without calling onConfirm.
EnterWith 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

The picker inside keeps its own keys: see DatePicker and TimePicker.

Screen reader

Role
dialog, modal (React Aria useModalOverlay and useDialog): the rest of the page is hidden from assistive tech while it is open.
Accessible name
The required aria-label or aria-labelledby: the types reject a dialog with neither. In the time variant a title also 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: modeToggleButton at the start, then dismissButton and confirmButton at the end. Full screen, a close (x) button named labels.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 closedBy is "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 point aria-labelledby at 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 labels for the full-screen close and Save buttons.