Skip to content

fix: add heading tags to B2B org section#3347

Open
daniellefrappier18 wants to merge 2 commits into
mainfrom
daniellef/11297-fix-headings-missing-b2b-org-section
Open

fix: add heading tags to B2B org section#3347
daniellefrappier18 wants to merge 2 commits into
mainfrom
daniellef/11297-fix-headings-missing-b2b-org-section

Conversation

@daniellefrappier18
Copy link
Copy Markdown
Contributor

@daniellefrappier18 daniellefrappier18 commented May 15, 2026

What are the relevant tickets?

Fixes https://github.com/mitodl/hq/issues/11297

Description (What does it do?)

Adds heading tags to the B2B organization section of the dashboard for screen reader accessibility. This is a follow-up to #3253, which added headings to the My Learning section.

  • OrganizationCards (home dashboard): The "As a member of [Org] you have access to:" label is now an h2, and each contract name link is wrapped in an h3, establishing a proper heading hierarchy beneath the page's h1.
  • ContractContent (contract detail page): The welcome message title had variant="h5" which rendered as <h5>, skipping heading levels after the org name h1. Fixed to component="h2". The "No programs found" state had an incorrect duplicate h1 and fixed to h2.
  • Tests: Added getByRole("heading") assertions to OrganizationCards.test.tsx to verify both the org section and contract name headings are accessible.

Screenshots (if appropriate):

  • Desktop screenshots
  • Mobile width screenshots

BEFORE Dashboard Page
Screenshot 2026-05-15 at 11 28 13 AM

AFTER Dashboard Page
Screenshot 2026-05-15 at 11 27 41 AM

BEFORE Contact Page
Screenshot 2026-05-15 at 11 52 11 AM

AFTER Contact Page
Screenshot 2026-05-15 at 11 50 23 AM

How can this be tested?

Prerequisites:

  1. A local MITx Online instance with a B2B organization and contract configured.
  2. In MITx Online admin → B2B → Organizations, create a test org
  3. In B2B → Contracts, create a contract linked to that org
  4. In B2B → User organizations, add your local user to the org
  5. Assign the contract to the user

This change is best verified by inspecting the DOM in browser DevTools:

  1. Log into the dashboard as a user who is a member of a B2B organization
  2. On the home dashboard, open DevTools → Elements and inspect the org section ("As a member of [Org] you have access to:") — it should be an <h2> element, and each contract name below it should be an <h3>
  3. Click into a contract to open the contract detail page and inspect:
  4. The org name should be <h1>
  5. The welcome message title (if present) should be <h2>

Additional Context

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@daniellefrappier18 daniellefrappier18 marked this pull request as ready for review May 15, 2026 15:57
Copilot AI review requested due to automatic review settings May 15, 2026 15:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves screen reader accessibility on the B2B organization dashboard and contract detail views by introducing proper heading semantics and ensuring a consistent heading hierarchy under the page title.

Changes:

  • Dashboard org section: renders the org access label as an h2 and each contract title as an h3.
  • Contract detail page: adjusts welcome message and empty-state headings to avoid skipped/duplicate heading levels.
  • Adds RTL assertions to ensure the new headings are discoverable via getByRole("heading").

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
frontends/main/src/app-pages/DashboardPage/CoursewareDisplay/OrganizationCards.tsx Adds h2/h3 semantics for org section label and contract titles.
frontends/main/src/app-pages/DashboardPage/CoursewareDisplay/OrganizationCards.test.tsx Adds tests asserting org and contract headings are accessible via heading roles.
frontends/main/src/app-pages/DashboardPage/ContractContent.tsx Fixes heading levels for welcome message and “No programs found” states.

@daniellefrappier18 daniellefrappier18 added the Needs Review An open Pull Request that is ready for review label May 15, 2026
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.

2 participants