-
-
Notifications
You must be signed in to change notification settings - Fork 499
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
refactor: Misc accessibility improvements #1124
Conversation
class="logo" | ||
aria-label={title} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.logo
isn't used.
As for aria-label
, it replaces a spread title
prop (<svg title="..."
) which does nothing to my knowledge, and is used instead of <title>
for two reasons:
- On hover, most browsers will show the content of
<title>
as a tooltip. We don't really need or want this in the places we use this component. - FireFox's accessibility tools show that
<title>
does not count as heading text in the scenario of<h1><svg><title>...
, whilearia-label
does. This is important as we use this structure on our home page, where the main heading has no text in it, just our logo. With<title>
, that heading is completely empty.
if (to.href == '/' || to.path == '/') { | ||
e.preventDefault(); | ||
location.route('/branding'); | ||
} | ||
e.preventDefault(); | ||
location.route('/branding'); | ||
} | ||
const homeProps = to.href == '/' || to.path == '/' | ||
? { onContextMenu: BrandingRedirect, 'aria-label': 'Home' } | ||
: {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to only attach the handler to the one route it's used, and the 'aria-label': 'Home'
I think is more useful of a description, even if users are probably familiar with the concept that brand/sitename == "home"
<nav tabIndex={0} onFocus={this.open}> | ||
<nav onFocus={this.open}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no real reason a user would need to tab onto the nav container, there's nothing for them to do there. They can still tab onto the links within the container though.
<nav | ||
tabIndex={0} | ||
class={cx(style.toc, !(items && items.length > 1) && style.disabled)} | ||
> | ||
<nav class={cx(style.toc, !(items && items.length > 1) && style.disabled)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, tabbing onto the side bar has no use.
@@ -1,27 +0,0 @@ | |||
import marked from 'marked'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, unrelated, but long unused.
? [<a href={'#' + props.id} />, props.children] | ||
? [ | ||
<a href={'#' + props.id}> | ||
<svg width="16" height="16" viewBox="0 0 24 24" aria-label={`Link to: ${props.children} (#${props.id})`}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation (e.g., Link to: Setting up JSX (#setting-up-jsx)
) came from Vue's docs which I quite like, makes it quite clear why there's a link right alongside the heading content.
ecc50f2
to
4b65af0
Compare
color: #4b5363; | ||
color: #8b93a3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was failing contrast checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff 👍
Been trying to learn more accessibility stuff, figured I'd start here.