-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TINY-11482: fix tab navigation for ContextFormSlider
#10035
Conversation
WalkthroughThis pull request introduces a new changelog entry for the TinyMCE project, documenting a fix related to keyboard navigation for the ContextFormSlider component. Additionally, it modifies the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
modules/tinymce/src/themes/silver/main/ts/ui/context/ContextFormSlider.ts (1)
26-26
: LGTM! Consider documenting the navigation class.The addition of 'tox-toolbar-nav-js' class enables proper tab navigation, aligning with accessibility requirements. The implementation works in conjunction with existing keyboard handlers.
Consider adding a code comment explaining the purpose of 'tox-toolbar-nav-js' class for future maintainability.
modules/tinymce/src/themes/silver/test/ts/browser/editor/contextform/ContextSliderFormTest.ts (1)
157-174
: Consider enhancing keyboard navigation test coverage.While the current test effectively validates basic tab navigation, consider adding:
- Reverse navigation testing using Shift+Tab
- Verification that focus remains within the component
- Additional keyboard interaction tests (e.g., arrow keys on slider)
Here's a suggested enhancement:
it('TINY-11482: should navigate correctly via keyboard', async () => { const editor = hook.editor(); openToolbar(editor, 'test-form'); const buttonASelector = '.tox-pop button[aria-label="A"]'; const sliderSelector = '.tox-pop input'; const buttonBSelector = '.tox-pop button[aria-label="B"]'; // Forward tab navigation FocusTools.setFocus(SugarDocument.getDocument(), buttonASelector); await FocusTools.pTryOnSelector('Focus should be on the A button', SugarDocument.getDocument(), buttonASelector); TinyUiActions.keystroke(editor, Keys.tab()); await FocusTools.pTryOnSelector('Focus should be on the slider', SugarDocument.getDocument(), sliderSelector); TinyUiActions.keystroke(editor, Keys.tab()); await FocusTools.pTryOnSelector('Focus should be on the B button', SugarDocument.getDocument(), buttonBSelector); TinyUiActions.keystroke(editor, Keys.tab()); + + // Reverse tab navigation + await FocusTools.pTryOnSelector('Focus should stay on B button', SugarDocument.getDocument(), buttonBSelector); + TinyUiActions.keystroke(editor, Keys.tab(), { shiftKey: true }); + + await FocusTools.pTryOnSelector('Focus should be back on slider', SugarDocument.getDocument(), sliderSelector); + TinyUiActions.keystroke(editor, Keys.tab(), { shiftKey: true }); + + await FocusTools.pTryOnSelector('Focus should be back on A button', SugarDocument.getDocument(), buttonASelector); + + // Test arrow keys on slider + TinyUiActions.keystroke(editor, Keys.tab()); + await FocusTools.pTryOnSelector('Focus should be on slider', SugarDocument.getDocument(), sliderSelector); + TinyUiActions.keystroke(editor, Keys.right()); + const input = UiFinder.findIn<HTMLInputElement>(SugarBody.body(), sliderSelector).getOrDie(); + assert.isTrue(Number(Value.get(input)) > 37, 'Value should increase with right arrow'); });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
.changes/unreleased/tinymce-TINY-11482-2024-12-05.yaml
(1 hunks)modules/tinymce/src/themes/silver/main/ts/ui/context/ContextFormSlider.ts
(1 hunks)modules/tinymce/src/themes/silver/test/ts/browser/editor/contextform/ContextSliderFormTest.ts
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- .changes/unreleased/tinymce-TINY-11482-2024-12-05.yaml
🔇 Additional comments (1)
modules/tinymce/src/themes/silver/test/ts/browser/editor/contextform/ContextSliderFormTest.ts (1)
1-1
: LGTM! Import addition is appropriate.
The addition of Keys import is necessary for the new keyboard navigation test.
Related Ticket: TINY-11482
Description of Changes:
fix tab navigation for
ContextFormSlider
Pre-checks:
feature/
,hotfix/
orspike/
Review:
Docs ticket created (if applicable)GitHub issues (if applicable):
Summary by CodeRabbit
New Features
Bug Fixes
Tests