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

Make question-info a heading #79

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ const StepCard = ({
<StepCardHeader>
<div>
{leftHeaderChildren}
<div className="question-info">
<div className="question-info" role="heading" aria-level={2}>
Copy link
Contributor

Choose a reason for hiding this comment

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

seems like it's preferable to just use a heading tag: https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA12

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They cite styling as a reason it's preferable, but the reason I didn't use a heading tag was that I didn't want the style to change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Native HTML elements have implicit styling and features that won't necessarily be replicated with ARIA equivalents. For instance, heading elements will have specific styling adjustments made when viewing a page in a browser's Reader Mode.

I was more wondering about that second bit but it looks like our iframe doesn't currently render at all in reader mode...

{headerTitleChildren}
<span>{formattedQuestionNumber}</span>
{showTotalQuestions ? <span className="num-questions">&nbsp;/ {numberOfQuestions}</span> : null}
Expand Down
10 changes: 10 additions & 0 deletions src/components/__snapshots__/Card.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ exports[`StepCard matches snapshot 1`] = `
>
<div>
<div
aria-level={2}
className="question-info"
role="heading"
>
<span>
Question 1
Expand Down Expand Up @@ -59,7 +61,9 @@ exports[`StepCard matches snapshot with more than one question 1`] = `
>
<div>
<div
aria-level={2}
className="question-info"
role="heading"
>
<span>
Questions 1 - 3
Expand Down Expand Up @@ -113,7 +117,9 @@ exports[`TaskStepCard can optionally provide task 1`] = `
>
<div>
<div
aria-level={2}
className="question-info"
role="heading"
>
<span>
Question 1
Expand Down Expand Up @@ -152,7 +158,9 @@ exports[`TaskStepCard can optionally provide type 1`] = `
>
<div>
<div
aria-level={2}
className="question-info"
role="heading"
>
<span>
Question 1
Expand Down Expand Up @@ -191,7 +199,9 @@ exports[`TaskStepCard matches snapshot 1`] = `
>
<div>
<div
aria-level={2}
className="question-info"
role="heading"
>
<span>
Question 1
Expand Down
10 changes: 10 additions & 0 deletions src/components/__snapshots__/Exercise.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ exports[`Exercise using step data matches snapshot 1`] = `
>
<div>
<div
aria-level={2}
className="question-info"
role="heading"
>
<span>
Question 1
Expand Down Expand Up @@ -207,7 +209,9 @@ exports[`Exercise with question state data matches snapshot 1`] = `
>
<div>
<div
aria-level={2}
className="question-info"
role="heading"
>
<span>
Question 1
Expand Down Expand Up @@ -446,7 +450,9 @@ exports[`Exercise with question state data renders header icons with multiple ch
>
<div>
<div
aria-level={2}
className="question-info"
role="heading"
>
<span>
Question 1
Expand Down Expand Up @@ -771,7 +777,9 @@ exports[`Exercise with question state data renders header icons with two-step ex
>
<div>
<div
aria-level={2}
className="question-info"
role="heading"
>
<span>
Question 1
Expand Down Expand Up @@ -1082,7 +1090,9 @@ exports[`Exercise with question state data shows a detailed solution 1`] = `
>
<div>
<div
aria-level={2}
className="question-info"
role="heading"
>
<span>
Question 1
Expand Down
Loading