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

a11y: allow to pass axeConfig to baseline unit test #8145

Merged
merged 22 commits into from
Jan 27, 2025

Conversation

andrey-medvedev-vk
Copy link
Contributor


  • Unit-тесты
  • e2e-тесты
  • Документация фичи
  • Release notes

Описание

Изначально целью было в цифрах вывести проблемы с a11y, чтобы можно было видеть прогресс по улучшению a11y с каждым PR.
Идея была тестировать c помощью axe компоненты в playwright.
Эта работа уже была проделана в #5276 (comment).
Исходя из отчёта по результатам большинство ошибок было связано с конфигурацией примера, заданного для e2e тестирования.

У нас уже есть код, который проверяет все компоненты с помощью axe. Недостаток тут в том, что мы иногда отключаем эту проверку, если видим ошибки в a11y и они кажутся ложными и отключаем разом полностью проверку всех правил у компонента.

Так как у нас уже ведеться тестирование с помощью axe в юнит тестах, и проверки в axe во многом идентичны проверка того же axe в playwright (за исключением проверок цвета, а это сильно зависит от используемой темы), то мы решили пока что начать с малого - перестать полностью отключать a11y проверки в компонентах, и если в данный момент какие-то из ошибок поправить нельзя, то точечно выключать правило, чтобы было понятно где ошибка и с чем связана, чтобы потом её решить.

Для части компонентов с проблемами были созданы Issues:

Изменения

В функцию для юнит тестирования baselineComponent был добавлен параметр a11yConfig, который позволяет задавать конфигуракцию для axe, в том числе точечно отключать правила. Это позволяет не отключать сразу все правила c помощь {a11y: false}, а только те, которые в данные момент решить не получается и создать для решения issue/pr.

Часто для компонентов при проверке a11y не хватает label/title, для этого некоторые тесты были дополнены, чтобы a11y не ругался, из-за отстутвия необходимый лэйблов для инпута и т.п.

  • Для Alert компонента добавлен warning если title не задан и label/labelledby не передан.
  • Для baselineComponent тестов ModalPage/ModalCard добавлен ModalPageHeader в пример;
  • Для Alert/ModalPage/ModalCard/ModalCardBase в документацию добавлены пункты про a11y.

Release notes

Изменения

  • Alert: добавлено предупреждение, если title, aria-label или aria-labelledby не заданы

@andrey-medvedev-vk andrey-medvedev-vk added the a11y Доступность (цифровая) label Jan 14, 2025
@andrey-medvedev-vk andrey-medvedev-vk self-assigned this Jan 14, 2025
Copy link
Contributor

github-actions bot commented Jan 14, 2025

size-limit report 📦

Path Size
JS 393.15 KB (+0.01% 🔺)
JS (gzip) 119.25 KB (+0.02% 🔺)
JS (brotli) 98.05 KB (-0.09% 🔽)
JS import Div (tree shaking) 1.56 KB (0%)
CSS 344.54 KB (0%)
CSS (gzip) 42.71 KB (0%)
CSS (brotli) 34.02 KB (0%)

Copy link

codesandbox-ci bot commented Jan 14, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Contributor

github-actions bot commented Jan 14, 2025

e2e tests

Playwright Report

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.49%. Comparing base (f2f7055) to head (b3881d7).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8145      +/-   ##
==========================================
- Coverage   95.50%   95.49%   -0.01%     
==========================================
  Files         403      403              
  Lines       11495    11503       +8     
  Branches     3807     3812       +5     
==========================================
+ Hits        10978    10985       +7     
- Misses        517      518       +1     
Flag Coverage Δ
unittests 95.49% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Jan 14, 2025

👀 Docs deployed

Commit b3881d7

@andrey-medvedev-vk andrey-medvedev-vk marked this pull request as ready for review January 14, 2025 11:10
@andrey-medvedev-vk andrey-medvedev-vk requested a review from a team as a code owner January 14, 2025 11:10
Copy link
Contributor

@EldarMuhamethanov EldarMuhamethanov left a comment

Choose a reason for hiding this comment

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

🔥🔥🔥

@vkcom-publisher vkcom-publisher added the pr-needs-work Автоматизация: PR автоматически закроется через 14 дней при отсутствии активности label Jan 24, 2025
Copy link
Contributor

@inomdzhon inomdzhon left a comment

Choose a reason for hiding this comment

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

♿ 🚀

packages/vkui/src/components/ModalCardBase/Readme.md Outdated Show resolved Hide resolved
inomdzhon
inomdzhon previously approved these changes Jan 27, 2025
Copy link
Contributor

@inomdzhon inomdzhon left a comment

Choose a reason for hiding this comment

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

🙏

ps: мерж конфликт

@andrey-medvedev-vk andrey-medvedev-vk merged commit 7a953d8 into master Jan 27, 2025
28 of 29 checks passed
@andrey-medvedev-vk andrey-medvedev-vk deleted the mendrew/a11y-in-unit-tests branch January 27, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Доступность (цифровая) pr-needs-work Автоматизация: PR автоматически закроется через 14 дней при отсутствии активности
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants