Skip to content
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

[Issue #1885]: fix heading level a11y issue #1923

Merged
merged 5 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export function SearchFilterAccordion({
content: getAccordionContent(),
expanded: false,
id: "funding-instrument-filter",
headingLevel: "h4",
headingLevel: "h2",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This did not increase the size surprisingly - there's some other css that overrides this I think - I didn't investigate further since it just works here

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh! Yeah, this component lets you use whatever heading level you want, but styles them all the same (as consistently-sized accordion headings)

},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const SearchOpportunityStatus: React.FC<SearchOpportunityStatusProps> = ({

return (
<>
<h4 className="margin-bottom-1">Opportunity status</h4>
<h2 className="margin-bottom-1">Opportunity status</h2>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this make the heading larger? If so, you can apply utility classes so the h4 is h2-sized

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andycochran - this did become slightly larger to h2 size - are you suggesting using a div with a utility class that makes it h2 sized? We can't have the h4 tag anymore if we want to avoid the a11y flagged error

Copy link
Collaborator

Choose a reason for hiding this comment

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

Use the h2 (not a div) with font size utility classes to make it look like an h4

Copy link
Collaborator

@andycochran andycochran May 6, 2024

Choose a reason for hiding this comment

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

Hmm. Brainstorming here… 

We could use the same <h2 class="usa-accordion__heading"> so it matches the accordion headings. But that might be a hacky.

.usa-accordion__heading uses:

@include typeset($theme-accordion-font-family, $theme-body-font-size, 1);

…so we'd need to apply utility classes to make it match.

I think just <h2 class="margin-bottom-1 font-sans-md"> will do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

font-sans-xs is what was closest to an h4

<div className="grid-row flex-wrap">
{statusOptions.map((option) => (
<div key={option.id} className="grid-col-6 padding-right-1">
Expand Down
Loading