Skip to content

Scheduler - A11y - When appointment is deleted using KBN, the focus is lost#34210

Open
bit-byte0 wants to merge 1 commit into
DevExpress:26_1from
bit-byte0:fix/scheduler-a11y-appointment-delete-focus
Open

Scheduler - A11y - When appointment is deleted using KBN, the focus is lost#34210
bit-byte0 wants to merge 1 commit into
DevExpress:26_1from
bit-byte0:fix/scheduler-a11y-appointment-delete-focus

Conversation

@bit-byte0

@bit-byte0 bit-byte0 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@bit-byte0 bit-byte0 self-assigned this Jul 3, 2026
Copilot AI review requested due to automatic review settings July 3, 2026 20:36
@bit-byte0 bit-byte0 requested a review from a team as a code owner July 3, 2026 20:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Scheduler accessibility regression where keyboard deletion of an appointment can leave focus on body/nowhere. The change adds post-delete focus restoration for both the legacy and the new appointments implementations, with a fallback that moves focus to a reasonable Scheduler control when no appointments remain.

Changes:

  • Added a shared isFocusLost utility to detect when focus has fallen back to body or a detached element.
  • Implemented “restore focus after delete” flows for legacy KBN and the new appointments focus controller, with Scheduler-level fallback focusing.
  • Added unit/integration coverage (Jest-like tests + TestCafe e2e) for focus restoration scenarios (next/previous, toolbar fallback, workspace fallback, canceled delete, recurring occurrence).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/devextreme/js/__internal/scheduler/utils/is_focus_lost.ts New utility to detect whether focus is effectively lost after DOM changes.
packages/devextreme/js/__internal/scheduler/scheduler.ts Adds Scheduler-level fallback focus logic and wires it into new appointments props.
packages/devextreme/js/__internal/scheduler/m_subscribes.ts Exposes fallback focus hook for legacy observer/subscribe plumbing.
packages/devextreme/js/__internal/scheduler/appointments/m_appointments_kbn.ts Tracks deleted item index and restores focus after rerender for legacy KBN.
packages/devextreme/js/__internal/scheduler/appointments/m_appointment_collection.ts Calls into KBN after items rerender to trigger focus restoration when needed.
packages/devextreme/js/__internal/scheduler/appointments_new/appointments.ts Switches from resetTabIndex to onViewItemsRendered to support delete focus restore.
packages/devextreme/js/__internal/scheduler/appointments_new/appointments.test.ts Updates test helper props for the new focusFallbackAfterDelete option.
packages/devextreme/js/__internal/scheduler/appointments_new/appointments.focus_controller.ts Implements pending-delete tracking + focus restoration for the new appointments rendering.
packages/devextreme/js/__internal/scheduler/tests/appointments.test.ts Adds coverage for focus behavior after deletion in the legacy appointments flow.
packages/devextreme/js/__internal/scheduler/tests/appointments_new.test.ts Adds coverage for focus behavior after deletion in the new appointments flow.
e2e/testcafe-devextreme/tests/scheduler/common/keyboardNavigation/appointments.ts Adds end-to-end regression tests for delete-key focus restoration.

Comment on lines +1572 to +1586
focusFallbackAfterDelete(): void {
const $headerFocusable = this.header?.$element()
.find('*')
.not('.dx-state-invisible, .dx-state-invisible *')
// @ts-expect-error filter callback overload should be added on dxElementWrapper level
.filter(tabbable)
.first();

if ($headerFocusable?.length) {
focus.trigger($headerFocusable);
return;
}

this._workSpace?.focus();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants