Skip to content

Commit

Permalink
WB-1804 Use h2 in ModalHeader (#2369)
Browse files Browse the repository at this point in the history
## Summary:
Per [this conversation](https://khanacademy.slack.com/archives/C8Z9DSKC7/p1732258953822829), we want to update the headers in modals to use `h2` instead of the default `h3` that comes with `HeadingMedium`s

Issue: WB-1804

(Related: AX-340)

## Test plan:

- [x] Run unit and snapshot tests with `yarn test` and` yarn jest -u`
- [x] Verify in Storybook that `OnePaneDialog` and `ModalHeader` have `h2` titles instead of `h3`
![image](https://github.com/user-attachments/assets/703b69a2-bcf5-4176-afdb-84b5f6a9ab9f)

Author: Chalayyy

Reviewers: jandrade, Chalayyy

Required Reviewers: 

Approved By: jandrade

Checks: ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Lint / Lint (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 2/2), ✅ Test / Test (ubuntu-latest, 20.x, 1/2), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ⏭️  Chromatic - Skip on Release PR (changesets), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ gerald, ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 2/2), ✅ Test / Test (ubuntu-latest, 20.x, 1/2), ✅ Lint / Lint (ubuntu-latest, 20.x), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ⏭️  Chromatic - Skip on Release PR (changesets), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ⏭️  dependabot, ✅ gerald

Pull Request URL: #2369
  • Loading branch information
Chalayyy authored Nov 26, 2024
1 parent c512e76 commit b5cad0b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-moons-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/wonder-blocks-modal": patch
---

Use h2 tag in modal header instead of h3
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ describe("ModalHeader", () => {
expect(screen.getByText("Title")).toBeInTheDocument();
});

test("uses an h2 tag for the title", () => {
// Arrange, Act
render(<ModalHeader title="Title" titleId="modal-title" />);

// Assert
expect(
screen.getByRole("heading", {level: 2, name: "Title"}),
).toBeInTheDocument();
});

test("using only `breadcrumbs` should render the header", () => {
// Arrange, Act
render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export default function ModalHeader(props: Props) {
<View style={styles.breadcrumbs}>{breadcrumbs}</View>
)}
<HeadingMedium
tag="h2"
style={styles.title}
id={titleId}
testId={testId && `${testId}-title`}
Expand Down

0 comments on commit b5cad0b

Please sign in to comment.