Skip to content

fix: replace global focus outline removal with :focus-visible for key…#5839

Open
manvirsingh01 wants to merge 1 commit intosugarlabs:masterfrom
manvirsingh01:fix/focus-outline-accessibility-5828
Open

fix: replace global focus outline removal with :focus-visible for key…#5839
manvirsingh01 wants to merge 1 commit intosugarlabs:masterfrom
manvirsingh01:fix/focus-outline-accessibility-5828

Conversation

@manvirsingh01
Copy link

Description

Fixes #5828

The CSS rule *:focus { outline: none; } in css/activities.css removes visible focus indicators from all elements, making it impossible for keyboard users to track which element is focused. This violates WCAG 2.4.7 (Focus Visible).

This PR replaces the blanket suppression with a :focus-visible approach that:

  • Shows a visible blue (#0066FF) focus ring when navigating with the keyboard (Tab key)
  • Hides the focus ring for mouse/touch interactions (preserving the original aesthetic intent)

Changes

File Change
css/activities.css Replaced *:focus { outline: none } with *:focus:not(:focus-visible) + *:focus-visible rule
css/style.css Scoped input[type="range"] outline suppression to mouse-only via :focus:not(:focus-visible)
planet/css/style.css Removed hardcoded outline: none from #backToTopBtn (now handled by global rule)

How to Test

  1. Open Music Blocks in a browser
  2. Press Tab repeatedly — a blue focus ring should appear around each interactive element
  3. Click any button with the mouse — no focus ring should appear
  4. Verify keyboard navigation is trackable across the entire interface

Before & After

  • Before: No visible focus indicator when pressing Tab — impossible to identify the active element
  • After: Clear blue outline appears on keyboard focus; mouse clicks remain clean

…board accessibility (sugarlabs#5828)

- Replace '*:focus { outline: none }' with ':focus:not(:focus-visible)' to hide
  outline for mouse/touch only
- Add '*:focus-visible' rule with visible blue (#0066FF) focus ring for keyboard
  navigation (WCAG 2.4.7)
- Scope range input and backToTopBtn outline suppression to mouse-only

Fixes sugarlabs#5828
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

Copy link
Contributor

@zealot-zew zealot-zew left a comment

Choose a reason for hiding this comment

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

we wouldn't be needing this, since the individual buttons have focus on themselves. There's a reason why it the toolbar Focus was set to None.

The issue is not discussed.

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.

[Accessibility] Global focus outline removal breaks keyboard accessibility

2 participants