-
Notifications
You must be signed in to change notification settings - Fork 4k
[feat] Update eslint rules for better a11y support #13412
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] Update eslint rules for better a11y support #13412
Conversation
✅ PR preview is ready!
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Pull request overview
This PR enhances accessibility linting by introducing a custom ESLint rule to prevent hiding interactive elements from screen readers, enabling three stricter jsx-a11y rules from the ecosystem, and fixing an existing violation where a checkbox lacked an accessible label.
Key Changes
- Created
no-aria-hidden-with-focusable-childrencustom ESLint rule to detect whenaria-hidden="true"is applied to elements containing focusable descendants - Enabled
jsx-a11y/control-has-associated-label,jsx-a11y/no-aria-hidden-on-focusable, andjsx-a11y/no-noninteractive-tabindexrules - Added
aria-labelto the audio recording checkbox in ScreencastDialog
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
frontend/eslint.config.mjs |
Enables the new custom rule and three stricter jsx-a11y rules in the ESLint configuration |
frontend/eslint-plugin-streamlit-custom/src/no-aria-hidden-with-focusable-children.ts |
Implements the custom ESLint rule that recursively checks for focusable descendants within aria-hidden containers |
frontend/eslint-plugin-streamlit-custom/src/no-aria-hidden-with-focusable-children.test.ts |
Adds comprehensive test cases covering valid and invalid usage patterns of the new rule |
frontend/eslint-plugin-streamlit-custom/src/index.ts |
Registers the new rule in the plugin's exports |
frontend/eslint-plugin-streamlit-custom/src/index.test.ts |
Updates the test to verify the new rule is properly exported |
frontend/app/src/hocs/withScreencast/components/ScreencastDialog/ScreencastDialog.tsx |
Fixes a11y violation by adding aria-label to the checkbox control |
frontend/eslint-plugin-streamlit-custom/src/no-aria-hidden-with-focusable-children.ts
Outdated
Show resolved
Hide resolved
📉 Frontend coverage change detectedThe frontend unit test (vitest) coverage has decreased by 0.0000%
✅ Coverage change is within normal range. |
74c62a2 to
8b8a1f9
Compare
dfe8c9d to
99c90d7
Compare
lukasmasuch
left a comment
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.
LGTM 👍
Merge activity
|
99c90d7 to
e7f33a2
Compare

Describe your changes
no-aria-hidden-with-focusable-childrento prevent hiding interactive elements from screen readers.jsx-a11y/control-has-associated-label- Requires accessible names for icon-only controlsjsx-a11y/no-aria-hidden-on-focusable- Prevents hiding focusable elements from assistive technologyjsx-a11y/no-noninteractive-tabindex- Avoids making non-interactive elements keyboard-focusableTesting Plan
aria-hiddenusage.Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.