Skip to content

fix: remove duplicate main landmark and make calculator tabs arrow-operable#975

Merged
Somil450 merged 1 commit into
Somil450:mainfrom
Anexus5919:fix/fitness-calc-a11y
Jul 9, 2026
Merged

fix: remove duplicate main landmark and make calculator tabs arrow-operable#975
Somil450 merged 1 commit into
Somil450:mainfrom
Anexus5919:fix/fitness-calc-a11y

Conversation

@Anexus5919

Copy link
Copy Markdown
Contributor

📌 Related Issue

Fixes #892 (addresses A11Y-4 and A11Y-5)


📝 Description

Two accessibility problems in FitnessCalculator.

🔹 What has been changed?

  • A11Y-4 (duplicate main landmark): FitnessCalculator declared role="main" while rendering inside App's <main>, producing two main landmarks. Removed it (and the now-redundant aria-label).
  • A11Y-5 (tabs not keyboard-operable): the tab bar already had the ARIA tab roles but no keyboard behavior. Implemented the WAI-ARIA tabs pattern: roving tabIndex (only the selected tab is tabbable) plus an onKeyDown handler for Arrow keys and Home/End that moves selection and focus.

🔹 Why are these changes needed?

  • A page must have exactly one main landmark, and an ARIA tablist should be a single tab stop navigable with Arrow keys. The previous code had two main landmarks and tabs that weren't arrow-operable.

🛠️ Type of Change

  • 🐛 Bug Fix

🧪 Testing

✅ Tests Performed

  • Tested locally
  • npx tsc --noEmit and npx eslint src/components/FitnessCalculator.tsx clean.
  • Verified the roving-tabindex + Arrow/Home/End handler moves selection and focus, and that the duplicate role="main" is removed.

🔹 Note on automated tests

No committed test: keyboard/landmark behavior needs @testing-library/react, which can't currently run (@testing-library/dom evicted from node_modules).

🌐 Browsers Tested

Not applicable here (landmark/keyboard behavior; visible in the DevTools Accessibility pane).


📷 Screenshots / Demo (if applicable)

Not applicable.


📋 Checklist

  • I have read the project's CONTRIBUTING guidelines
  • My code follows the project style guidelines
  • I have performed a self-review of my code
  • I have tested my changes locally
  • I have added/updated documentation where necessary (not applicable)
  • My changes do not introduce new warnings or errors
  • This PR is linked to an existing issue

💬 Additional Notes

Branched from upstream/main; merges cleanly with the current base.

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

@Anexus5919 is attempting to deploy a commit to the somiljain2024-4175's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Anexus5919

Copy link
Copy Markdown
Contributor Author

@Somil450 @diksha78dev Kindly have a review on this pr. Thanks!

…erable

FitnessCalculator declared role="main" while rendering inside App's <main>,
producing two main landmarks on the page. The tab bar already had the ARIA
tab roles but no keyboard support: every tab was in the tab order and arrow
keys did nothing.

Drop the redundant role="main", and implement the WAI-ARIA tabs keyboard
pattern: roving tabindex (only the selected tab is tabbable) plus Arrow,
Home, and End handling that moves selection and focus.
@Anexus5919 Anexus5919 force-pushed the fix/fitness-calc-a11y branch from 6987fed to b0d2986 Compare July 1, 2026 07:20
@Anexus5919

Copy link
Copy Markdown
Contributor Author

@Somil450 @diksha78dev Kindly have a review on this pr. Thanks!

@Anexus5919

Copy link
Copy Markdown
Contributor Author

This failing check is from main, not this PR. Main's CI is currently broken (ShieldAlert used without importing it, plus untyped "privacy"/"terms&conditions" screens), so every PR goes red, even docs-only ones. Fix is up in #1039. Once it merges, a rebase turns this green. Merges cleanly with base.

@Somil450 Somil450 self-requested a review July 9, 2026 13:58
@Somil450 Somil450 added gssoc-26 Marks GSSoC issues gssoc:approved Officially reviewed and approved GSSoC contribution ready for scoring mentor:Somil450 Reviewed and mentored by Somil450 for GSSoC contribution tracking. level:intermediate Moderate complexity requiring good understanding of project structure and implementation. mentor-approved labels Jul 9, 2026
@Somil450 Somil450 merged commit bbe3523 into Somil450:main Jul 9, 2026
0 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Officially reviewed and approved GSSoC contribution ready for scoring gssoc-26 Marks GSSoC issues level:intermediate Moderate complexity requiring good understanding of project structure and implementation. mentor:Somil450 Reviewed and mentored by Somil450 for GSSoC contribution tracking. mentor-approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FitnessCalculator: duplicate main landmark and tabs not arrow-key operable

2 participants