# Keyboard and accessibility

> The keyboard model of every calendar view, the ARIA structure screen readers see, live announcements, and what to keep in mind when you customize the calendar.

Everything in the calendar works from the keyboard, including moving, resizing and removing events. Screen readers hear each day with its date and event count, and each event with its title, time, date, location and whether it repeats.

## Focus

Each view is a single tab stop with a roving `tabindex`: <kbd>Tab</kbd> moves into the view, to the day or event that had focus last, and the arrow keys move inside it. The toolbar buttons are ordinary buttons before it in the tab order. Focus is always visible, drawn with `--lq-cal-focus`, which follows `--lq-focus-ring`.

After a keyboard move or resize, focus stays on the moved event, even when it moved to another day.

## Keyboard

### On a day

| Key | Action |
| --- | --- |
| <kbd>ArrowLeft</kbd> / <kbd>ArrowRight</kbd> | Previous or next day, skipping hidden days. |
| <kbd>ArrowUp</kbd> / <kbd>ArrowDown</kbd> | Same day of the previous or next week, in the month and year views. |
| <kbd>Home</kbd> / <kbd>End</kbd> | First or last visible day of the week. |
| <kbd>PageUp</kbd> / <kbd>PageDown</kbd> | Previous or next period. With <kbd>Shift</kbd>: previous or next year. |
| <kbd>Enter</kbd> or <kbd>F2</kbd> | Move into the day's events. On an empty day, emit `dateClick`. |
| <kbd>Space</kbd> | Emit `dateClick` for the day, for example to create an event. |

In the week, day and N-day views the days are the column headers, so <kbd>ArrowLeft</kbd> and <kbd>ArrowRight</kbd> move between them.

### On an event

| Key | Action |
| --- | --- |
| <kbd>ArrowUp</kbd> / <kbd>ArrowDown</kbd> | Previous or next event of the same day. Up from the first event returns to the day. |
| <kbd>ArrowLeft</kbd> / <kbd>ArrowRight</kbd> | Previous or next event in the view. |
| <kbd>Home</kbd> / <kbd>End</kbd> | First or last event of the day. |
| <kbd>Enter</kbd> or <kbd>Space</kbd> | Emit `eventClick`, the same as a click. |
| <kbd>Escape</kbd> | Back to the day. |
| <kbd>Alt</kbd> + <kbd>ArrowUp</kbd> / <kbd>ArrowDown</kbd> | Move the event earlier or later by `snapMinutes` in the time grid, or by a week in the month view. |
| <kbd>Alt</kbd> + <kbd>ArrowLeft</kbd> / <kbd>ArrowRight</kbd> | Move the event by one day. |
| <kbd>Alt</kbd> + <kbd>Shift</kbd> + arrows | Change the event's end by the same steps, never shorter than one snap step (or one day for all-day events). |
| <kbd>Delete</kbd> or <kbd>Backspace</kbd> | Remove the event, emitting `eventRemove`. |

On macOS, <kbd>Alt</kbd> is the <kbd>Option</kbd> key. Editing keys do nothing in `readOnly` mode or on events with `editable: false`.

### Agenda, "+N more" and the popover

- In the agenda, the arrow keys move between events, <kbd>Home</kbd> and <kbd>End</kbd> jump to the first and last event, and <kbd>PageUp</kbd> and <kbd>PageDown</kbd> move by a screenful.
- On a "+N more" button, <kbd>Enter</kbd> or <kbd>Space</kbd> opens the popover and focuses its first event.
- In the popover, <kbd>ArrowUp</kbd>, <kbd>ArrowDown</kbd>, <kbd>Home</kbd> and <kbd>End</kbd> move between events, <kbd>Enter</kbd> or <kbd>Space</kbd> emits `eventClick`, <kbd>Delete</kbd> removes, and <kbd>Escape</kbd> closes it and returns focus to the button.
- During a pointer drag, <kbd>Escape</kbd> cancels the drag.

Keyboard edits go through the same path as pointer edits: they are checked by `validateDrop` and `validateResize`, emit `eventDrop`, `eventResize` and `eventRemove` with `source: 'keyboard'`, and can be reverted. See [Interactions](https://docs.birchui.com/calendar/interactions.md).

## What screen readers get

| Element | Semantics |
| --- | --- |
| Toolbar | Buttons with accessible names ("Previous", "Next", "Today"). The view switcher is a group labelled "View" whose buttons use `aria-pressed`. The title is a heading and a polite live region, so moving to another period announces it. |
| Month view | `role="grid"` labelled with the title, with `aria-readonly` reflecting `readOnly`. Weekday column headers have full weekday names; each day is a `gridcell` labelled like "Tuesday, December 8, 2026, 3 events", with `aria-current="date"` on today and `aria-selected` while it is part of a selection. |
| Week, day and N-day views | A labelled group. Each day's column header is labelled with its date and event count and marks today with `aria-current="date"`. The time axis is hidden from assistive technology. |
| Agenda | A list labelled with the title. Each event is a list item with `aria-setsize` and `aria-posinset`, so position stays correct while the list virtualizes. |
| Year view | One read-only `grid` per month, with each day labelled by date and event count. |
| Event | `role="button"`, labelled with title, time, date or date range, the event's `location` if it has one, and "Repeats" for recurring events. |
| "+N more" | A button with `aria-haspopup="dialog"`, labelled like "+3 more, Tuesday, December 8, 2026". The popover is a `dialog` labelled by its heading, with a labelled close button. |
| Loading | The root gets `aria-busy="true"` and the toolbar's status region says "Loading events". |

The drag preview is hidden from assistive technology. When an event is moved or removed from the keyboard, a polite live region announces the result, such as "Site visit: Northgate Clinic, Wednesday, December 9, 2026" or "Site visit: Northgate Clinic removed".

All of these strings come from `locale` (dates) and `labels` (everything else), so they are announced in your users' language once you translate the labels. See [Views](https://docs.birchui.com/calendar/views.md#the-toolbar).

## Motion, contrast and color

- Transitions and the loading spinner run only when the user has not asked for reduced motion.
- `theme: 'auto'` follows `prefers-color-scheme` and switches live.
- In Windows high-contrast mode (`forced-colors`), event blocks and bars get system-colored borders and today is outlined, so nothing depends on custom colors.
- For colored events, the text color is chosen automatically for contrast against the event's `color`.

## Checklist for customization

- Keep `title` meaningful even if `eventRenderer` shows something else. The accessible name is built from the title, not from your rendered content.
- Put a `location` field on events when place matters; it is included in the accessible name.
- Content returned by `eventRenderer` sits inside the event's button. Do not put links, buttons or inputs in it; open details from `eventClick` instead.
- Mark decorative icons in custom content with `aria-hidden="true"`.
- Do not convey status with color alone. Add a word to the title or the rendered content, such as "Tentative" or "Cancelled".
- If you hide the toolbar with `headerToolbar: false`, provide your own previous, next and today buttons and a visible title, for example from `getTitle()`.

## Next steps

- [Interactions](https://docs.birchui.com/calendar/interactions.md) for change payloads and validation.
- [Views](https://docs.birchui.com/calendar/views.md) for labels and the toolbar.
