fix: Restore accessibility focus states across palette and global inputs#7378
fix: Restore accessibility focus states across palette and global inputs#7378Kr-Utkarsh-01 wants to merge 4 commits into
Conversation
|
🧪 Jest Test Results ❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Coverage: Statements: 47.05% | Branches: 38.51% | Functions: 51.53% | Lines: 47.47% Note: These failures may be introduced by this PR or may already exist in the master branch. Failed Tests: |
b8bbcb6 to
aabe252
Compare
|
🧪 Jest Test Results ❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Coverage: Statements: 47.55% | Branches: 38.79% | Functions: 52.45% | Lines: 47.95% Note: These failures may be introduced by this PR or may already exist in the master branch. Failed Tests: |
|
This PR has merge conflicts with Please rebase your branch: # Add upstream remote (one-time setup)
git remote add upstream https://github.com/sugarlabs/musicblocks.git
# Fetch latest master and rebase
git fetch upstream
git rebase upstream/master
# Resolve any conflicts, then:
git push --force-with-lease origin YOUR_BRANCH
|
|
🧪 Jest Test Results ✅ All Jest tests passed! This PR is ready to merge. Coverage: Statements: 47.57% | Branches: 38.82% | Functions: 52.47% | Lines: 47.97% |
e2e8d6f to
2fbb765
Compare
|
🧪 Jest Test Results ✅ All Jest tests passed! This PR is ready to merge. Coverage: Statements: 47.62% | Branches: 38.87% | Functions: 52.45% | Lines: 48.03% |
2fbb765 to
2760c9d
Compare
|
🧪 Jest Test Results ❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Coverage: Statements: 48.11% | Branches: 39.52% | Functions: 52.84% | Lines: 48.52% Note: These failures may be introduced by this PR or may already exist in the master branch. Failed Tests: |
|
🧪 Jest Test Results ✅ All Jest tests passed! This PR is ready to merge. Coverage: Statements: 48.04% | Branches: 39.53% | Functions: 52.82% | Lines: 48.44% |
Problem
Two accessibility issues prevent keyboard users from seeing focus indicators:
Palette keyboard navigation applies hover highlights using inline
style.backgroundColorassignments tied toplatformColor.hoverColor. This couples visual state to JS-driven color values, making highlights impossible to theme via CSS.Global
outline: noneoverrides on#search:focus(activities.css:239) andinput[type="range"]:focus(style.css:12) suppress the*:focus-visibleoutline ring for keyboard users, violating WCAG 2.4.7 (Focus Visible).addresses #6606
Solution
Commit 1 — Replace the 4 inline
style.backgroundColorassignments in_updateKeyboardFocusand_clearKeyboardFocuswithclassList.add/remove("palette-keyboard-hover"). This decouples the keyboard focus highlight from hardcoded JS color values, enabling theming through CSS:Commit 2 — Narrow the blanket
:focus { outline: none }rules to:focus:not(:focus-visible)so that:Tabfocus preserves the2px solid #0066ffoutline from the global*:focus-visibleruleChanges
js/palette.jsstyle.backgroundColor→classList.add/remove("palette-keyboard-hover")in_updateKeyboardFocusand_clearKeyboardFocuscss/activities.css#search:focus→#search:focus:not(:focus-visible)css/style.cssinput[type="range"]:focus→input[type="range"]:focus:not(:focus-visible)PR Category
Testing
npm test— 5187/5187 passingnpm run lint— 0 errorsnpx prettier --check— all modified files formattedBrowser Testing Required
npm run serve:devhttp://127.0.0.1:3000Tabto focus the palette → use arrow keys → verify a visible highlight follows the focused rowTabinto the search box → verify a blue outline ring appears around itTabto the slider → verify a blue outline ring appearsUpstream Test Regression Fixes
js/widgets/__tests__/aidebugger.test.jswhere the_sendMessageunit tests failed because of a recent upstream master commitd7e16bc81introducing a consent flow check. The tests have been updated to mock_consentGiven = trueand assert on the correct behavior when consent is not granted.