Skip to content

Conversation

@arthurgousset
Copy link
Collaborator

Summary

Fixes WCAG 2.1.1 (Keyboard) and WCAG 2.4.3 (Focus Order) violations by making the search input field keyboard accessible while preventing focus trap issues.

Issues Resolved: #23, #77 (duplicates describing the same problem)

Problem: The search input field had a disabled attribute that blocked keyboard users from accessing core search functionality on the Zanichelli homepage.

Solution: Removed the disabled attribute and implemented proper focus management using aria-hidden and tabIndex to prevent focus when the field is visually hidden.

Changes

Search Input Field (search-form.tsx)

  • Removed: disabled={!this.showSearchbar} attribute from input element
  • Added: aria-label="Cerca per parola chiave o ISBN" for screen reader support
  • Added: aria-hidden={!this.showSearchbar ? 'true' : undefined} to hide from AT when closed
  • Added: tabIndex={!this.showSearchbar ? -1 : 0} to remove from tab order when closed

Reset Button (consistency improvement)

  • Removed: disabled={!this.showSearchbar} attribute
  • Added: aria-hidden and tabIndex pattern matching input field

Test Plan

  • Verified search field receives keyboard focus on page load
  • Confirmed keyboard input works (typed "matematica" successfully)
  • Tested Tab key navigation - field is in tab order when visible
  • Verified field is NOT in tab order when visually hidden (no focus trap)
  • Confirmed accessibility tree shows no [disabled] attribute
  • Tested with screen reader context (aria-label provides proper context)
  • Code review passed with no critical issues

Evidence

View before/after screenshots, accessibility trees, and full verification results:
https://app.workback.ai/dashboard/issue/23/

Key Results:

  • Before: searchbox "Cerca per parola chiave o ISBN" [disabled]
  • After: searchbox "Cerca per parola chiave o ISBN" (enabled, properly managed)
  • ✅ Focus test: {"disabled": false, "focused": true, "canReceiveFocus": true}
  • ✅ Keyboard input test: Successfully typed "matematica"
  • ✅ No focus trap when hidden

WCAG References:

Removes disabled attribute from search input field to fix WCAG 2.1.1
(Keyboard) Level A violation while preventing focus trap issues.

Changes:
- Remove disabled={!this.showSearchbar} from input element
- Add aria-label for improved screen reader support
- Add aria-hidden and tabIndex to prevent focus when hidden (WCAG 2.4.3)
- Apply same pattern to reset button for consistency

Impact:
- Keyboard-only users can now access search functionality
- Screen reader users get better context
- Motor-impaired users no longer blocked from search
- No focus trap when search field is visually hidden
- Fixes Critical severity accessibility issue

WCAG Success Criteria:
- 2.1.1 Keyboard (Level A)
- 2.4.3 Focus Order (Level A)

https://www.w3.org/WAI/WCAG21/Understanding/keyboard.html
https://www.w3.org/WAI/WCAG21/Understanding/focus-order.html
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.

2 participants