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.
Declaration
DayPilot.Scheduler.onKeyboardFocusChange(args)Parameters
args.focus- the new focus target (not yet active)args.previous- the current focus targetargs.preventDefault()- cancels the default action for theEscapeandEnterkeys
Notes
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.
Examples
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.
};See Also
Keyboard Support [doc.daypilot.org]
DayPilot.Scheduler.keyboard.move()
DayPilot.Scheduler.keyboard.getFocus()
DayPilot.Scheduler.onKeyboardFocusChanged
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot