Skip to content

Commit

Permalink
Add aria-level to role=heading elements
Browse files Browse the repository at this point in the history
Accessibility scanner flagged this as an issue.
  • Loading branch information
mmcfarland committed Mar 6, 2024
1 parent 7ae2e88 commit 0be8dce
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 92 deletions.
190 changes: 99 additions & 91 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^9.0.9",
"@craco/craco": "7.0.0-alpha.3",
"@fluentui/react": "^8.106.1",
"@fluentui/react": "^8.115.6",
"@radiantearth/stac-fields": "1.0.0-beta.7",
"@reduxjs/toolkit": "^1.8.2",
"@testing-library/jest-dom": "^5.16.4",
Expand Down
5 changes: 5 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ export const a11yPostProcessDom = (dom: Document) => {
dom.querySelectorAll(".highlight pre").forEach(el => {
el.setAttribute("tabindex", "0");
});

// <p> tags with role="heading" need an aria-level attribute
dom
.querySelectorAll("p[role=heading]")
.forEach(el => el.setAttribute("aria-level", "3"));
};

export const scrollToHash = (
Expand Down

0 comments on commit 0be8dce

Please sign in to comment.