keyboardUndo
Undo and redo from the keyboard inside an editable calendar.
| Type | boolean |
|---|---|
| Default | true |
Live update (update()) | Yes |
| Declared in | packages/dom/src/settings.ts |
What it does
Section titled “What it does”In an editable calendar, Ctrl/Cmd+Z undoes the last change and
Ctrl/Cmd+Shift+Z (or Ctrl+Y) redoes it, said for a screen reader — when the
focus is in the calendar, not in your fields, and not while an event is
held. False leaves those keys to your application (its own undo across the
page). calendar.undo() and calendar.redo() work either way.
Example
Section titled “Example”import { createCalendar } from '@dzcalendar/dom';
const calendar = createCalendar(element, { timeZone: 'Europe/Paris', editable: true, keyboardUndo: false });
// The application's own undo, for the whole page.document.addEventListener('keydown', (e) => { if ((e.ctrlKey || e.metaKey) && e.key === 'z') calendar.undo();});import { Component } from '@angular/core';import { DZ_CALENDAR } from '@dzcalendar/angular';
@Component({ selector: 'app-agenda', imports: [DZ_CALENDAR], template: `<dz-calendar timeZone="Europe/Paris" [editable]="true" [options]="{ keyboardUndo: false }" />`,})export class Agenda {}import { DzCalendar } from '@dzcalendar/react';
export function Agenda() { return <DzCalendar timeZone="Europe/Paris" editable keyboardUndo={false} />;}<script setup lang="ts">import { DzCalendar } from '@dzcalendar/vue';</script>
<template> <DzCalendar time-zone="Europe/Paris" editable :options="{ keyboardUndo: false }" /></template>In Angular and Vue it goes in options; in React it is a prop.
See also
Section titled “See also”historyLimit— how many changes can be undone.editable— the changes a person makes.- Keyboard and accessibility.