Fragiola

Getting started

Accessible names and the keyboard

The roles, the one tab stop and the keys the calendar wires, and the names, dates and announcements you write in your own words.

The package sets the roles, the tab stop, the focus and the keys; it sets no text and no aria-label. Every name a screen reader reads is yours: the grid's, each event's, each button's, and the words of each announcement.

Name the grid and the buttons

A grid needs a name, and an icon button needs one too:

<Calendar.DayGrid aria-label="November 2026">{/* … */}</Calendar.DayGrid>

<Calendar.Previous aria-label="Previous month">
    <ChevronLeft aria-hidden />
</Calendar.Previous>
<Calendar.ViewButton view="week">Week</Calendar.ViewButton>

Calendar.ViewButton sets aria-pressed for the view shown; Calendar.Previous, Today and Next are disabled (and carry data-disabled) when the model cannot run their command.

Name each event

An event's part is a listitem inside its day's list. Its accessible name is its content, or an aria-label you give it: say what a sighted reader sees, the title and the times.

function TimedEvent({ segment }: { segment: TimeSegment }) {
    const { model } = useCalendar();
    const event = model.get("event-by", { id: segment.eventId });
    const occurrence = model.get("occurrence-by", { id: segment.occurrenceId });
    const times = occurrence ? timesText(occurrence.start, occurrence.end) : "";
    return (
        <Calendar.TimeEvent segment={segment} aria-label={`${event?.title}, ${times}`}>
            <span>{event?.title}</span>
            <span aria-hidden>{times}</span>
        </Calendar.TimeEvent>
    );
}

function timesText(start: string, end: string): string {
    return new Intl.DateTimeFormat("en-US", { hour: "numeric", minute: "2-digit" })
        .formatRange(Date.parse(start), Date.parse(end));
}

Say the dates

A day cell of a month shows "26"; a screen reader needs "Thursday, November 26". The date is data on every day, column and slot (data-date, and the day.date your children function or slot receives): write it as visually hidden text.

<Calendar.Day day={day}>
    <span aria-hidden>{Number(day.date.slice(8))}</span>
    <span className="visually-hidden">{dayInWords(day.date)}</span>
    <Calendar.DayEvents>{(segment) => <EventSegment segment={segment} />}</Calendar.DayEvents>
</Calendar.Day>
function dayInWords(date: string): string {
    const [year = 1970, month = 1, day = 1] = date.split("-").map(Number);
    return new Intl.DateTimeFormat("en-US", {
        weekday: "long",
        month: "long",
        day: "numeric",
        timeZone: "UTC",
    }).format(Date.UTC(year, month - 1, day));
}

The keyboard model

There is no WAI-ARIA pattern for an event calendar; the calendar combines two. The month and the time grid are an APG grid with one tab stop and a roving focus over the dates, with the date picker's keys, and each date's events are a list of focusable items.

keyson a date (a day, or a time-grid slot)on an event
Arrowsmove a day (Up and Down: a week in a month, a slot in a time grid)Up and Down: the day's previous or next event
Home, Endthe first or last day of the week
PageUp, PageDownthe previous or next range (view.previous, view.next)
Shift + PageUp, PageDowna year (month), a week (time grids)
Enter (or F2 on a date)into the date's events (a slot: the events starting in it)Enter: event-click
Escapeback to its date
Tableaves the gridleaves the grid

A day's "+N more" link (Calendar.More) is the last item of its events: Down from the day's last event reaches it, and Enter on it is the engine's more-click. With the features installed, Shift and the arrows on a date select a range (Selecting ranges), and Space on an event grabs it to move it with the arrows and resize it with Shift and the arrows (Keyboard).

The keys follow the reading direction: in a right-to-left calendar, Left moves to the next day.

Word the announcements

A drag by the keyboard, or a selection grown with Shift, is announced as data: onAnnounce (@announce in Vue, (announce) in Angular) receives what happened (grab, drag-over, drop, drag-cancel, select-extend) with the occurrence and its times. Write the words into a live region of your own:

const [message, setMessage] = useState("");

<Calendar.Root
    model={model}
    onAnnounce={({ announcement }) => {
        if (announcement.kind === "grab") setMessage("Grabbed. Arrows move it, Enter drops it.");
        if (announcement.kind === "drag-cancel") setMessage("Left where it was.");
    }}
>
    <div role="status" aria-live="polite">{message}</div>
    {/* … */}
</Calendar.Root>

The keyboard example words every announcement.