patternfly / patternfly/patternfly-react
Bug - Button - update aria-disabled logic to be more correct
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 862
- Forks
- 392
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 9
Description
Describe the problem
Followup to https://github.com/patternfly/patternfly-react/issues/11617 for breaking change release. We should update the logic of aria-disabled being applied. Currently aria-disabled is always set and is setup to basically match the disabled value (otherwise we end up with aria-disabled being false when disabled is true, which is contradictory and has potential to cause issue with AT – FWIW in limited testing it seems like disabled has priority, but should still be considered an issue).
Additionally, we were mixing the way to disable the Button depending on the component prop in https://github.com/patternfly/patternfly-react/pull/11478. Instead we should be more explicit that isDisabled should be used when a) the component is button, or b) the button doesn't need to be focusable for a tooltip or similar, and isAriaDisabled should be used when a) the component is anything other than button, or b) when the button is intended to be focusable/hoverable to trigger a Tooltip or similar.
Expected behavior
aria-disabled only renders when true, which matches how the disabled attribute gets rendered (only when true, not rendered when false), and aria-disabled must be set explicitly (rather than having isDisabled set it when component !== button).
Jira Issue: PF-2208
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the TypeScript Button component and its existing accessibility test coverage. Review how isDisabled, isAriaDisabled, component, disabled, and aria-disabled are handled, then verify that aria-disabled is rendered only when explicitly true and that the documented focusable and non-focusable cases behave as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100