Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: add ARIA labels to navigation for accessibility (#435)#437

Open
Pratham-r05 wants to merge 1 commit into
ashutosh1919:masterfrom
Pratham-r05:fix/aria-labels-navigation-435
Open

fix: add ARIA labels to navigation for accessibility (#435)#437
Pratham-r05 wants to merge 1 commit into
ashutosh1919:masterfrom
Pratham-r05:fix/aria-labels-navigation-435

Conversation

@Pratham-r05
Copy link
Copy Markdown

Summary

Fixes #435 β€” The navigation hamburger menu button and nav element lacked ARIA attributes, making the site inaccessible for screen reader users.

Changes made (src/components/header/Header.js only)

  • Added aria-label="Toggle navigation menu" and aria-controls="nav-menu" to the hamburger checkbox input β€” screen readers now announce the button's purpose and its controlled region
  • Added aria-hidden="true" to the menu label β€” hides the decorative icon from assistive tech since the checkbox is already announced
  • Added id="nav-menu", role="navigation", and aria-label="Main navigation" to the <ul> β€” makes it a discoverable landmark and satisfies the aria-controls reference

What was NOT changed

  • No styling, layout, or behaviour modified
  • No other files touched

Test plan

  • 6 unit tests written and passing (Header.test.js)
    • renders without crashing
    • hamburger checkbox has aria-label for toggle
    • hamburger checkbox has aria-controls pointing to nav menu
    • menu label is hidden from screen readers via aria-hidden
    • nav ul has correct id, role, and aria-label
    • aria-controls on checkbox matches id of nav ul
  • Existing functionality intact β€” no visual or behavioural regressions

Closes #435

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.

Improve Navigation Accessibility with ARIA Labels

1 participant