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

refactor(v2): add title attribute to anchor link #2066

Merged
merged 3 commits into from
Nov 29, 2019
Merged
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
7 changes: 6 additions & 1 deletion packages/docusaurus-theme-classic/src/theme/Heading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ const Heading = Tag => ({id, ...props}) => {
return (
<Tag {...props}>
<a aria-hidden="true" tabIndex="-1" className="anchor" id={id} />
<a aria-hidden="true" tabIndex="-1" className="hash-link" href={`#${id}`}>
<a
aria-hidden="true"
tabIndex="-1"
className="hash-link"
href={`#${id}`}
title="Direct link to heading">
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we check in react-axe or something if this will cause duplicated title issue on a11y ?

Like every a title will be this Direct link to heading

Maybe

Suggested change
title="Direct link to heading">
title={`Direct link to heading with id` + id}>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we check in react-axe or something if this will cause duplicated title issue on a11y ?

No, there will not be such an issue. I checked via the axe extension.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok we're good to merge this then

#
</a>
{props.children}
Expand Down