Skip to content

2832 accessibility updates round two#2843

Merged
howardchung merged 4 commits intoodota:masterfrom
micahchiang:2832-accessibility-updates-round-two
Oct 18, 2021
Merged

2832 accessibility updates round two#2843
howardchung merged 4 commits intoodota:masterfrom
micahchiang:2832-accessibility-updates-round-two

Conversation

@micahchiang
Copy link
Contributor

@micahchiang micahchiang commented Oct 9, 2021

Description

As part of an ongoing effort to improve the overall accessibility of the OpenDota web client, this pull request adds some additional accessibility fixes to various parts of the application including:

  • Add proper heading levels to the homepage
  • Updated footer markup
  • Fixing keyboard navigation on api page by refactoring button markup.

Things to know

  • Though the number of lines changed shows over 100, most of that is due to nesting / un-nesting refactors and not actual code change.
  • Though this pull request includes some markup refactoring, it introduces no visual changes or regressions. Screenshots are attached to each change to demonstrate this.
  • Comments on each change will include brief explanations of the original problem, the fix, and why it matters for accessibility.

}
<h1>{strings.api_title}</h1>
<h3>{strings.api_subtitle}</h3>
<h2>{strings.api_subtitle}</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 and the above css change were made to ensure heading levels only progress by one.

Why it matters

  • Sighted users have little problem determining the structure of a page based on what they see. Screenreader users rely on assistive technology to provide the structure of a page. Most screenreaders provide the option to navigate by heading levels, which are rendered in app as a sort of table of contents.
  • More in-depth explanation here

Screenshots for visual integrity

Before Screen Shot 2021-10-09 at 10 32 07 AM Screen Shot 2021-10-09 at 10 32 36 AM
After Screen Shot 2021-10-09 at 10 32 17 AM Screen Shot 2021-10-09 at 10 32 46 AM

<a href={`${process.env.REACT_APP_API_HOST}/login`}>
<RaisedButton primary label={strings.api_login} style={{ margin: '5px 5px' }} />
</a>
<RaisedButton primary href={`${process.env.REACT_APP_API_HOST}/login`} label={strings.api_login} style={{ margin: '5px 5px' }} />
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 change fixes keyboard navigation on the two buttons (Login to access API & Read the Docs).

Currently keyboard navigation will first focus on the a tag, and then on the embedded button tag, requiring 4 instead of the expected 2 keystrokes to navigate. Visual users can see that these are just actionable buttons / links, but screenreader users may be thrown off by the way keyboard navigation progresses.

The RaisedButton component can accept an href as one of its props, where it will then render an a tag using the existing styles.

Screenshot showing no visual change Screen Shot 2021-10-09 at 10 12 38 AM

<a href="//docs.opendota.com" target="_blank" rel="noopener noreferrer">
<RaisedButton label={strings.api_docs} style={{ margin: '5px 5px' }} />
</a>
<RaisedButton href="//docs.opendota.com" target="_blank" rel="noopener noreferrer" label={strings.api_docs} style={{ margin: '5px 5px' }} />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above comment on keyboard navigation.

: <div />
}
<h3>{strings.api_header_table}</h3>
<h2>{strings.api_header_table}</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.

See above comment on heading level progression.

This css change ensures the h2 tags are the same font-size as the previous h3 tags.

<tr>
{/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}
<th />
<th aria-hidden="true"/>
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 needs to be hidden from screenreaders as it doesn't contain any discernible text for them to read.

Comment on lines +129 to +141
}

@media only screen and (max-width: 960px) {
padding: 20px 25px 15px;
flex-direction: column;
@media only screen and (max-width: 960px) {
padding: 20px 25px 15px;
flex-direction: column;

& .links,
& .cheese {
width: 100%;
}
& .links,
& .cheese {
width: 100%;
}

& .cheese {
margin-top: 20px;
}
& .cheese {
margin-top: 20px;
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 looks big, but it's just un-nesting some styles, not any changes to the actual styles.

<span id="app-powered-by">{strings.app_powered_by}</span>
<a href="http://steampowered.com" aria-describedby="app-description app-powered-by" target="_blank" rel="noopener noreferrer">
<IconSteam />
<div className="links">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar to the above comment about un-nesting styles, this change removes the main tag from the footer.

Why it matters

  • Screen readers provide their users the option to navigate by landmark. Typically, there should be one main content landmark which houses the body of the app content. Visual users don't rely semantic landmark tags to understand page layout, but screenreader users do. Currently, if a screenreader user were to navigate to the <main> tag, they would be actually navigating to the footer.
  • More in-depth explanation here

Screenshots for visual integrity

Current footer Screen Shot 2021-10-09 at 9 07 38 AM
With main tag removed Screen Shot 2021-10-09 at 9 08 54 AM

Comment on lines +13 to +16
<h1>{strings.app_name}</h1>
</HeadlineDiv>
<DescriptionDiv>
{strings.app_description}
<h2>{strings.app_description}</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.

Currently, screenreader users aren't able to navigate by headings or gain proper context for the homepage because no headings exist. This wraps the heading strings in proper heading levels so screenreaders can properly parse them. Computed font-sizes remain identical.

Screenshots showing visual integrity

Current homepage Screen Shot 2021-10-09 at 11 00 40 AM Screen Shot 2021-10-09 at 11 00 23 AM
With new headers Screen Shot 2021-10-09 at 11 04 00 AM Screen Shot 2021-10-09 at 11 04 10 AM

Comment on lines +22 to +25
& h1 {
all: inherit;
}

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 css is added to the h1 inherits everything from its parent.

Comment on lines +40 to +43
& h2 {
all: inherit;
}

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 css is added to the h2 inherits everything from its parent.

@micahchiang micahchiang marked this pull request as ready for review October 9, 2021 16:07
@howardchung howardchung merged commit 645085e into odota:master Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants