# Keyboard and accessibility

> The keyboard map of the task grid and the timeline, linking tasks from the keyboard, what screen readers announce, and how the splitter, themes and reduced motion are handled.

Everything in the Gantt works from the keyboard: navigating, editing cells, outlining, moving and resizing bars, and drawing links. Screen readers hear tasks with their dates, progress and status, and every change is announced.

## Structure

| Part | Semantics |
| --- | --- |
| Root | A `role="group"` labelled by `ariaLabel` (default "Project schedule"). Give each Gantt a specific name, such as "Distribution centre fit-out". |
| Task list | A WAI-ARIA `treegrid` labelled "Tasks", with expandable summary rows, levels and a roving focus, provided by the Birch UI Grid core. |
| Splitter | A focusable `role="separator"` labelled "Resize task list", with its width in `aria-valuenow`. |
| Timeline | A focusable region labelled "Timeline", with the visible range described on its header. |
| Task bars | A group labelled "Task bars". Each bar is a `role="button"` with an accessible name such as "Install pallet racking, 18 Jan to 29 Jan, 20% complete, critical" or "Handover to operations, milestone, 5 Feb", and a short description of the keyboard commands. |
| Links, grid lines, today line, baselines | Hidden from assistive technology; links are available as text in the predecessors column. |
| Live region | A polite `status` region that announces changes. |

Accessible names include "summary" for summary tasks, "critical" for critical tasks and "constraint conflict" when a constraint overrides a link.

## Keyboard in the task list

| Keys | Action |
| --- | --- |
| Arrow keys, <kbd>Home</kbd>, <kbd>End</kbd>, <kbd>PageUp</kbd>, <kbd>PageDown</kbd> | Move between cells. |
| <kbd>Enter</kbd>, <kbd>F2</kbd> or typing | Edit the cell. <kbd>Enter</kbd> commits, <kbd>Escape</kbd> cancels. |
| <kbd>ArrowRight</kbd> / <kbd>ArrowLeft</kbd> on a summary's name | Expand or collapse it. |
| <kbd>Tab</kbd> / <kbd>Shift</kbd>+<kbd>Tab</kbd> | Indent or outdent the task. When that is not possible, focus moves on as usual. |
| <kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>ArrowRight</kbd> / <kbd>ArrowLeft</kbd> | Indent or outdent, also with `tabToIndent: false`. |
| <kbd>Insert</kbd> / <kbd>Ctrl</kbd>+<kbd>Enter</kbd> | Add a task above or below and edit its name. |
| <kbd>Ctrl</kbd>+<kbd>Delete</kbd> | Delete the task and its subtasks. |

Because <kbd>Tab</kbd> falls back to moving focus whenever it cannot outline a row, keyboard users can always leave the task list. With `tabToIndent: false`, <kbd>Tab</kbd> only moves focus.

## Keyboard on the timeline

| Keys | Action |
| --- | --- |
| <kbd>ArrowDown</kbd> on the timeline | Focus the first bar (or the last focused one). |
| <kbd>ArrowUp</kbd> / <kbd>ArrowDown</kbd> | Previous or next bar. |
| <kbd>Home</kbd> / <kbd>End</kbd> | First or last bar. |
| <kbd>Enter</kbd> | Select the task and emit `taskClick`. |
| <kbd>Space</kbd> | Select the task. |
| <kbd>Escape</kbd> | Clear the selected link, or the selected task. |
| <kbd>Alt</kbd>+<kbd>ArrowLeft</kbd> / <kbd>ArrowRight</kbd> | Move the task by one working day, or one snap step in hour-based presets. |
| <kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>ArrowLeft</kbd> / <kbd>ArrowRight</kbd> | Shorten or extend the task by the same step. |
| <kbd>D</kbd> | Start linking from the task (see below). |
| <kbd>Delete</kbd> or <kbd>Backspace</kbd> | Remove the selected link. |
| <kbd>Ctrl</kbd>+<kbd>Delete</kbd> | Delete the task. |

## Anywhere

| Keys | Action |
| --- | --- |
| <kbd>Ctrl</kbd>/<kbd>Cmd</kbd>+<kbd>Z</kbd> | Undo. |
| <kbd>Ctrl</kbd>/<kbd>Cmd</kbd>+<kbd>Y</kbd> or <kbd>Ctrl</kbd>/<kbd>Cmd</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd> | Redo. |

On macOS, <kbd>Alt</kbd> is the <kbd>Option</kbd> key. Shortcuts are ignored while typing in an editor. In `readOnly` mode, navigation and selection work and editing keys do nothing.

Keyboard moves go through the same rules as drags: they are snapped to working time, checked by `validateTaskChange`, set a start-no-earlier-than constraint, and emit `taskChange` with `source: 'keyboard'`.

## Linking from the keyboard

1. Focus a bar and press <kbd>D</kbd>. The live region announces "Linking from Floor repairs and sealing, finish-to-start".
2. Press <kbd>ArrowUp</kbd> or <kbd>ArrowDown</kbd> to choose the task to link to. Each target is announced, with a note when the link is not allowed.
3. Press <kbd>ArrowLeft</kbd> or <kbd>ArrowRight</kbd> to attach to the target's start or finish, or <kbd>T</kbd> to cycle through FS, SS, FF and SF.
4. Press <kbd>Enter</kbd> to create the link, or <kbd>Escape</kbd> to cancel. <kbd>Tab</kbd> also cancels and moves focus on.

Keyboard links follow the [dependency rules](https://docs.birchui.com/gantt/dependencies.md#rules-and-validation) and `validateDependency`, and emit `dependencyCreate` with `source: 'keyboard'`.

## Announcements

The live region reports every change in plain language, for example:

- "Install pallet racking starts 18 Jan 2027"
- "LED high-bay lighting now lasts 7 days"
- "Install pallet racking is 40% complete"
- "Linked Floor repairs and sealing to Install pallet racking, FS"
- "Selected the FS link from Survey to Permit. Press Delete to remove it."
- "WMS configuration is now at level 2"
- "The change to Handover was not allowed"
- "Predecessors not changed: this link would create a dependency loop"
- "Undone", "Redone", "Added New task", "Deleted Floor repairs and sealing"

Invalid grid input is reported the same way, so users hear why an edit did not apply.

## Splitter

Focus the splitter between grid and timeline and use <kbd>ArrowLeft</kbd> / <kbd>ArrowRight</kbd> (16 pixels, 64 with <kbd>Shift</kbd>), <kbd>Home</kbd> (narrowest) and <kbd>End</kbd> (widest). Its value is exposed through `aria-valuenow`, `aria-valuemin` and `aria-valuemax`.

## Themes, contrast and motion

- `theme` is `'light'` (default), `'dark'` or `'auto'`, which follows `prefers-color-scheme`.
- In Windows high-contrast mode (`forced-colors`), bars and links use system colors.
- Animations and transitions are turned off when the user prefers reduced motion.
- Critical tasks, conflicts and progress are part of each bar's accessible name and visible in the grid, so they do not depend on color alone.

## Checklist for your project

- Give every task a meaningful `name`; it is the bar's accessible name.
- Name the Gantt with `ariaLabel`.
- If you color bars by status with `color`, also show the status in a [custom column](https://docs.birchui.com/gantt/task-grid.md#columns).
- Keep `tabToIndent` on unless your users expect <kbd>Tab</kbd> only to move focus; leaving the grid always works either way.

## Next steps

- [Task grid](https://docs.birchui.com/gantt/task-grid.md) for editing details.
- [Interactions](https://docs.birchui.com/gantt/interactions.md) for the pointer equivalents.
