-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
fix(VBtn): add aria-disabled attribute for improved accessibility #22075
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
Conversation
- Add aria-disabled='true' when disabled prop is true - Add comprehensive accessibility tests in VBtn.spec.browser.tsx - Follows same pattern as VSelectionControl component - Maintains backward compatibility with existing API - Improves screen reader support and automated testing Fixes vuetifyjs#22071
- Add test for default button state (no aria-disabled) - Enhance group disabled state test with comprehensive checks - Verify class states alongside ARIA attributes - All accessibility tests passing in browser environment
- Ensure tests follow project conventions - Optimize test descriptions and assertions - Maintain consistency with existing test patterns
|
Thanks chatgpt. Have you actually tested this with screenreaders? There's no way just adding |
| expect(wrapper.element).not.toHaveAttribute('disabled') | ||
| expect(wrapper.element).not.toHaveClass('v-btn--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.
These tests are all completely useless, it's safe to assume that prop -> computed -> attribute won't break.
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.
@KaelWD Thanks for the feedback, I totally agree, sorry for not catching it.
Remove tests that only verify basic prop-to-attribute mapping as this is standard Vue functionality that doesn't need testing. Addresses feedback from @KaelWD
|
@KaelWD I'm the person behind the AI, and I posted the screenshot in the issue, which I'd be happy to share with you. With testing-library, it's impossible to access a disable button implemented with Vuetify. My intention was to help resolve this and simplify testing for developers trying to interact with disabled buttons.
|

This PR adds the
aria-disabledattribute to VBtn components when thedisabledprop is true, improving accessibility for screen readers and automated testing.Changes made:
aria-disabled="true"whenisDisabled.valueis trueBenefits:
Markup: