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

feat: add aria attributes for MiniToc #244

Merged
merged 7 commits into from
Jul 12, 2024

Conversation

Pavel-Tyan
Copy link
Contributor

add aria-label to MiniToc and aria-current for MiniToc headings.

Task: https://github.com/orgs/diplodoc-platform/projects/2/views/1?pane=issue&itemId=55495812

@martyanovandrey
Copy link
Contributor

Left some comments here
#217 (comment)

  • aria-current already added for <li> elements
  • aria-label should be used with translation like aria-label={t('description')}in this file
    translation can be added only for russian and english

return (
<div className={b()}>
<div className={b()} aria-label={t('article navigation')}>
Copy link
Contributor

Choose a reason for hiding this comment

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

label should be article-navigation and it need to be aded here and in "ru"
https://github.com/diplodoc-platform/components/blob/master/src/i18n/en.json#L50

add hyphen in aria-label value

add Russian and English translation
replace div to nav tag
replace div to h1 for title
wrap MiniToc links into h2 and h3 tags
Copy link
Contributor Author

@Pavel-Tyan Pavel-Tyan left a comment

Choose a reason for hiding this comment

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

Before using nav and h1-h6 tags:

2024-07-11.09-13-35.mov

After:

2024-07-11.10-37-54.mov

Screen Reader: https://www.nvaccess.org

Copy link
Contributor

@martyanovandrey martyanovandrey left a comment

Choose a reason for hiding this comment

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

Hey, the videos are great, it's great that you made them.
There are a couple of things that need to be fixed.

Let's leave the title only for the dc-mini-toc__title and make a div tag -> h2. We will leave the remaining elements as links in the mini-current itself, it will be more correct, this became more noticeable thanks to the video with a screen reader.

Apparently Scrollspy component already adds an aria-current label for mini-current elements, which means we don’t need to put miniTocContent into a separate variable at all and can leave it as is.

delete h2, h3 tags from MiniToc items
delete aria-current from MiniToc items
change h1 to h2 for MiniToc title
wrap MiniToc title in div
<div className={b()}>
<div className={b('title')}>{t<string>('title')}:</div>
<nav className={b()} aria-label={t('article-navigation')}>
<div>
Copy link
Contributor

Choose a reason for hiding this comment

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

for what reason you need extra div here ?

@martyanovandrey martyanovandrey merged commit 16ce81c into diplodoc-platform:master Jul 12, 2024
1 check passed
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