Skip to content

Fix: Remove Empty Anchor Link in Jump-To Menu on Reference Pages #889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

reshma045
Copy link

@reshma045 reshma045 commented Jul 1, 2025

Summary
This PR resolves the accessibility issue reported in #881 by removing an empty link in the jump-to navigation on reference pages like /reference/p5.sound/. The issue was caused by a JumpToLink with no label, resulting in a screen reader announcing only “link” with no context.

Issue: Closes #881

What Was Changed

Modified ReferenceLayout.astro to:

  • Filter out jump-to links that have no label (undefined) when categoryData.length === 1.
  • This situation occurs on reference pages that only contain a single category (like p5.sound), where the first subcategory has no name, resulting in a duplicate unnamed link.
  • Also included a fallback label ("Details") from UI translations to ensure accessibility compliance for any remaining edge cases.

How to Test

  • Go to /reference/p5.sound/
  • Open the jump-to menu or inspect the headings/links with a screen reader.
  • No unnamed or empty links should appear in the navigation.

@coseeian
Copy link
Collaborator

coseeian commented Jul 5, 2025

Could you please describe the purpose of the fixed “Details” link? Is it intended to navigate to another resource? When I click it, nothing happens.

@reshma045
Copy link
Author

The "Details" label is a fallback that only appears if a jump-to link’s label is undefined, which shouldn't happen under normal circumstances due to the filtering I added. It's there purely for accessibility compliance to ensure that no empty link is ever rendered, in case any edge cases are missed.
In this specific fix, when categoryData.length === 1, the first unnamed subcategory link (which previously caused the empty link) is now filtered out. So the "Details" fallback should not be visible in typical usage. If it's still appearing and doesn't link to a valid section, I will investigate further and improve the logic to avoid rendering it altogether. Please let me know if you’d prefer I remove the fallback label completely instead of showing a generic one.

@coseeian
Copy link
Collaborator

coseeian commented Jul 5, 2025

When I press Shift+Tab on the "p5.Amplitude" link, I see a "Details" link (Details). However, clicking this link does not navigate to any section.

@reshma045
Copy link
Author

Thanks! The fallback "Details" label was being rendered even though it didn’t link to a valid section. I’ve now updated the logic to completely skip all links with undefined labels, removing the fallback entirely. This should prevent any non-functional links like "Details" from appearing.

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.

[Link] Empty Link
2 participants