The onKeyboardFocusChange event handler fires when the keyboard focus is about to change, either after the user presses an arrow key or when keyboard.move() is called.
It is called before the actual focus change, and you can cancel the change using args.preventDefault().
Available since 2021.3.5075.
DayPilot.Scheduler.onKeyboardFocusChange(args)args.focus - the new focus target (not yet active)
args.previous - the current focus target
args.preventDefault() - cancels the default action for the Escape and Enter keys
The args.focus and args.previous properties use the same focus object structure as keyboard.getFocus(). This event lets you inspect the pending focus target and keep the current one by calling args.preventDefault() before the change is applied.
JavaScript
const dp = new DayPilot.Scheduler("dp", {
onKeyboardFocusChange: (args) => {
console.log("Keyboard focus is about to change", args.previous, args.focus);
// Call args.preventDefault() here to keep the current focus target.
},
// ...
});
dp.init();Angular
<daypilot-scheduler [config]="config"></daypilot-scheduler>config: DayPilot.SchedulerConfig = {
onKeyboardFocusChange: (args) => {
console.log("Keyboard focus is about to change", args.previous, args.focus);
// Call args.preventDefault() here to keep the current focus target.
},
// ...
};React
<DayPilotScheduler
onKeyboardFocusChange={onKeyboardFocusChange}
{/* ... */}
/>const onKeyboardFocusChange = (args) => {
console.log("Keyboard focus is about to change", args.previous, args.focus);
// Call args.preventDefault() here to keep the current focus target.
};Vue
<DayPilotScheduler
@keyboardFocusChange="onKeyboardFocusChange"
<!-- ... -->
/>const onKeyboardFocusChange = (args) => {
console.log("Keyboard focus is about to change", args.previous, args.focus);
// Call args.preventDefault() here to keep the current focus target.
};Keyboard Support [doc.daypilot.org]
DayPilot.Scheduler.keyboard.move()
DayPilot.Scheduler.keyboard.getFocus()