Skip to content

Conversation

@jonkafton
Copy link
Contributor

@jonkafton jonkafton commented Oct 29, 2025

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/8557

Description (What does it do?)

Adds the ARIA heading role to resource card titles to they are treated as heading elements and navigable by screen reader users.

The titles are links, so we don't want to replace them with heading elements as they then would not be discoverable as links.

Instead, we're adding an additional span element with the heading role and aria-level.

Cards within carousels use the next heading level down from the carousel section title.

Elsewhere we set to the lowest level, H6. We know there are no subheadings, but it's challenging to reliably determine the next level up on the page in all instances to avoid level gaps.

How can this be tested?

VoiceOver on Mac:

  • Start VoiceOver with cmd+F5.
  • On pages with resource cards (home page carousels, resource drawers, search and channel pages).
  • Press ctrl+opt+cmd+H to navigate headings.
    • Ensure that carousel card title are focused and announced.
  • Press ctrl+opt+U to open the rotor.
    • Use left/right arrows to cycle through the element type lists.
    • Ensure card titles appear in the headings list. If they are in a carousel, ensure that they are a level down from the carousel section title.
    • Ensure the car titles appear as links in the links list.
  • cmd+F5 to stop VoiceOver.
  • Info: https://dequeuniversity.com/screenreaders/voiceover-keyboard-shortcuts

NVDA on Windows:

  • Download from https://www.nvaccess.org/download/ and install
  • Press H to navigate headings.
    • Carousel titles should be announced with "clickable".
    • Headings a specific levels can also be navigated by pressing 1-6.
  • Press Insert+F7 to show element lists. I'm using Parallels on Mac. Fn+enter is mapped to the insert key.
    • Select headings and check that the card headings appear at the expected level.
    • Select links and check that the card heading appear as links.
  • Info: https://dequeuniversity.com/screenreaders/nvda-keyboard-shortcuts

JAWS on Windows:

@jonkafton jonkafton added the Needs Review An open Pull Request that is ready for review label Oct 29, 2025
test("Headings", async () => {
setupAPIs()

setMockResponse.get(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: It would be straightforward to give assertHeadings a maxLevel opt. That might be a more transparent approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

Eh, I guess that doesn't help here actually, since below we do test for h3

Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

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

👍 This is working well. I left a few suggestions.

I do think the LinkableTitle change is worth making and the SearchDisplay change.

@jonkafton jonkafton merged commit 31ff8cb into main Nov 6, 2025
13 checks passed
@jonkafton jonkafton deleted the jk/8557-card-accessibility-headings branch November 6, 2025 14:38
This was referenced Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants