Scheduler - A11y - When appointment is deleted using KBN, the focus is lost#34210
Open
bit-byte0 wants to merge 1 commit into
Open
Scheduler - A11y - When appointment is deleted using KBN, the focus is lost#34210bit-byte0 wants to merge 1 commit into
bit-byte0 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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
isFocusLostutility to detect when focus has fallen back tobodyor 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(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.