Skip to content

Implement keyboard navigation improvements in HtmlEditor#34309

Open
Raushen wants to merge 10 commits into
DevExpress:mainfrom
Raushen:HTMLEditor_KBN
Open

Implement keyboard navigation improvements in HtmlEditor#34309
Raushen wants to merge 10 commits into
DevExpress:mainfrom
Raushen:HTMLEditor_KBN

Conversation

@Raushen

@Raushen Raushen commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@Raushen Raushen self-assigned this Jul 14, 2026
Copilot AI review requested due to automatic review settings July 14, 2026 21:48
@Raushen Raushen requested a review from a team as a code owner July 14, 2026 21:48
@Raushen Raushen added the 26_2 label Jul 14, 2026

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

Adds “focus escape” keyboard navigation for HtmlEditor content (Ctrl+Shift+Up/Down), enabling users to move focus to the toolbar or to the nearest focusable element outside the editor. This is implemented via new shared focus utilities and is covered by new unit and TestCafe e2e tests.

Changes:

  • Add focus traversal helpers (getFirstFocusableElement, getNextFocusableElement, getPreviousFocusableElement) and centralize the “all focusables” selector in m_selectors.
  • Implement HtmlEditor Ctrl+Shift+Up/Down handling, including focusing the first toolbar item when appropriate.
  • Update TestCafe HtmlEditor toolbar models and add/adjust e2e + unit tests for the new keyboard behavior.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/testcafe-models/toolbar/toolbarItem.ts Adds a TestCafe model wrapper for toolbar items with an isFocused helper.
packages/testcafe-models/htmlEditor/rootToolbar.ts Switches getItemByName to return a ToolbarItem model (used by updated tests).
packages/devextreme/js/__internal/ui/toolbar/toolbar.ts Adds focusFirstItem() to programmatically focus the first focusable toolbar element.
packages/devextreme/js/__internal/ui/popover/popover.ts Adjusts top-overlay comparison typing in the Escape key handler.
packages/devextreme/js/__internal/ui/html_editor/modules/m_toolbar.ts Uses a Toolbar implementation that exposes focusFirstItem() and proxies it from the module.
packages/devextreme/js/__internal/ui/html_editor/html_editor.ts Implements Ctrl+Shift+Up/Down focus escape from editor content and returns toolbar method results.
packages/devextreme/js/__internal/ui/html_editor/tests/focus_escape.test.ts Adds unit tests for focus escape behavior.
packages/devextreme/js/__internal/ui/tests/mock/model/html_editor.ts Adds a minimal HtmlEditor test model for dispatching keyboard events and querying key elements.
packages/devextreme/js/__internal/grids/new/grid_core/keyboard_navigation/const.ts Re-exports the shared focusables selector from m_selectors.
packages/devextreme/js/__internal/core/utils/m_selectors.ts Moves/exports ALL_FOCUSABLE_ELEMENTS_SELECTOR and adds isElementVisible as a named export.
packages/devextreme/js/__internal/core/utils/focus.ts Introduces shared focus traversal utilities used by HtmlEditor/Toolbar.
packages/devextreme/js/__internal/core/utils/focus.test.ts Adds unit tests for the new focus traversal utilities.
e2e/testcafe-devextreme/tests/editors/htmlEditor/keyboard.ts Adds e2e coverage for HtmlEditor focus escape behavior.
e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/aiDialog/common.ts Updates to click toolbar item .element after model return type change.
e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/common.ts Updates to click toolbar item .element after model return type change.
e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/addImageUrl.ts Updates to click toolbar item .element after model return type change.
e2e/testcafe-devextreme/tests/editors/htmlEditor/dialogs/addImage/addImageFromDevice.ts Updates to click toolbar item .element after model return type change.
e2e/testcafe-devextreme/tests/editors/htmlEditor/common.ts Updates to click toolbar item .element after model return type change.
e2e/testcafe-devextreme/tests/accessibility/htmlEditor.ts Updates to click toolbar item .element after model return type change.
e2e/testcafe-devextreme/helpers/domUtils.ts Adds helper to inject a focusable element after a target for navigation tests.

Comment thread packages/testcafe-models/htmlEditor/rootToolbar.ts
Comment thread packages/devextreme/js/__internal/ui/popover/popover.ts Outdated

_keyDownHandler(e: ValueChangedEvent): void {
this._saveValueChangeEvent(e);
this._handleFocusEscape(e as unknown as KeyboardEvent);

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.

Can we somehow avoid such casting?

Comment thread packages/devextreme/js/__internal/ui/popover/popover.ts Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 12:59

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

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Comment thread e2e/testcafe-devextreme/helpers/domUtils.ts
Comment thread packages/devextreme/js/__internal/ui/popover/popover.ts
Copilot AI review requested due to automatic review settings July 15, 2026 14:13

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.


const overlayStack = this._overlayStack();
// @ts-ignore expected: types Overlay<OverlayProperties> and this have no overlap
// @ts-expect-error expected: types Overlay<OverlayProperties> and this have no overlap

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I need to revert it because there is the following error then:

Image

Copilot AI review requested due to automatic review settings July 15, 2026 15:25
@Raushen Raushen requested a review from a team as a code owner July 15, 2026 15:25

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

Copilot reviewed 58 out of 58 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants