fix: make completion modal a little more accessible (#44508)

* fix: make completion modal a little more accessible

* remove: unneeded aria attribute

* fix: update snapshots
This commit is contained in:
Tom
2021-12-16 04:17:12 -06:00
committed by GitHub
parent 3355487dcb
commit c2aa8ce3e5
4 changed files with 21 additions and 16 deletions

View File

@ -8,15 +8,15 @@ function GreenPass(
return ( return (
<> <>
<span className='sr-only'>{t('icons.passed')}</span>
<svg <svg
aria-label={t('icons.passed')}
height='50' height='50'
viewBox='0 0 200 200' viewBox='0 0 200 200'
width='50' width='50'
xmlns='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg'
{...props} {...props}
> >
<g> <g aria-hidden='true'>
<title>{t('icons.passed')}</title> <title>{t('icons.passed')}</title>
<circle <circle
cx='100' cx='100'

View File

@ -42,12 +42,8 @@ exports[`<ChallengeTitle/> renders correctly 1`] = `
<b> <b>
title text title text
</b> </b>
<span
className="sr-only"
>
icons.passed
</span>
<svg <svg
aria-label="icons.passed"
height="50" height="50"
style={ style={
Object { Object {
@ -60,7 +56,9 @@ exports[`<ChallengeTitle/> renders correctly 1`] = `
width="50" width="50"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
<g> <g
aria-hidden="true"
>
<title> <title>
icons.passed icons.passed
</title> </title>

View File

@ -5,12 +5,8 @@ exports[`<CompletionModalBody /> matches snapshot 1`] = `
<div <div
class="completion-challenge-details" class="completion-challenge-details"
> >
<span
class="sr-only"
>
icons.passed
</span>
<svg <svg
aria-label="icons.passed"
class="completion-success-icon" class="completion-success-icon"
data-testid="fcc-completion-success-icon" data-testid="fcc-completion-success-icon"
height="50" height="50"
@ -18,7 +14,9 @@ exports[`<CompletionModalBody /> matches snapshot 1`] = `
width="50" width="50"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
<g> <g
aria-hidden="true"
>
<title> <title>
icons.passed icons.passed
</title> </title>
@ -62,14 +60,17 @@ exports[`<CompletionModalBody /> matches snapshot 1`] = `
intro:responsive-web-design.blocks.basic-html-and-html5.title intro:responsive-web-design.blocks.basic-html-and-html5.title
</div> </div>
<div <div
aria-label="learn.percent-complete"
class="progress-bar-wrap" class="progress-bar-wrap"
> >
<div <div
aria-hidden="true"
class="progress-bar-background" class="progress-bar-background"
> >
learn.percent-complete learn.percent-complete
</div> </div>
<div <div
aria-hidden="true"
class="progress-bar-percent" class="progress-bar-percent"
data-testid="fcc-progress-bar-percent" data-testid="fcc-progress-bar-percent"
style="width: 0%;" style="width: 0%;"

View File

@ -88,13 +88,19 @@ export class CompletionModalBody extends PureComponent<
</div> </div>
<div className='completion-block-details'> <div className='completion-block-details'>
<div className='completion-block-name'>{blockTitle}</div> <div className='completion-block-name'>{blockTitle}</div>
<div className='progress-bar-wrap'> <div
<div className='progress-bar-background'> className='progress-bar-wrap'
aria-label={t('learn.percent-complete', {
percent: completedPercent
})}
>
<div className='progress-bar-background' aria-hidden='true'>
{t('learn.percent-complete', { {t('learn.percent-complete', {
percent: this.state.shownPercent percent: this.state.shownPercent
})} })}
</div> </div>
<div <div
aria-hidden='true'
className='progress-bar-percent' className='progress-bar-percent'
data-testid='fcc-progress-bar-percent' data-testid='fcc-progress-bar-percent'
style={{ width: `${this.state.shownPercent}%` }} style={{ width: `${this.state.shownPercent}%` }}