-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor(multiple): default softDisabled to true #32240
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
Updates the default value of the input to across all ARIA components. This allows disabled items to receive focus by default, improving keyboard accessibility. - Grid focus coordinates behavior has also been updated to correctly handle focus when is enabled.
| /** Moves focus to the cell at the given coordinates if it's part of a focusable cell. */ | ||
| focusCoordinates(coords: RowCol): boolean { | ||
| if (this.gridDisabled()) { | ||
| if (this.gridDisabled() && !this.inputs.softDisabled()) { |
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.
I took a look at list-focus and it does not allow focusing on items when a list is disabled https://github.com/angular/components/blob/main/src/aria/private/behaviors/list-focus/list-focus.ts#L101 and can test with https://ng-comp-devapp.web.app/aria-listbox by setting both disabled and softDisabled to true.
so I think we should align the implementation between those two, either
- If a grid/list is disabled, then no cells/items can be focused when
softDisabledsets to true, or - if a grid/list is disabled, cells/items can still be focused when
softDisabledsets to true
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.
After chatting we discussed that it's probably best to keep them all focusable when softDisabled is set to true. So for consistency I have updated listbox.
…This commit refines the behavior across several a11y components (List, Listbox, Accordion, Tree) to ensure correct interaction between disabled states and navigation/selection. Specifically:\n\n- In , the method now explicitly checks if the list is disabled before allowing selection updates, preventing unintended selections when permits navigation.\n- In , a new method is introduced to clearly distinguish between a 'hard' disabled state (blocking all interaction) and a 'soft' disabled state (allowing navigation but blocking selection).\n- Corresponding tests in , , , and have been updated and expanded to accurately reflect and verify these refined interactions, ensuring that navigation and selection behave as expected in various disabled scenarios.
| return this.inputs.disabled() || this.inputs.items().every(i => i.disabled()); | ||
| } | ||
|
|
||
| /** Whether the list is in a disabled state, but should still be focusable */ |
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.
Should this be "list is in a disabled state and not focusable" or "list is in a hard disabled state"? The current doc comment sounds suggesting the list can be focused.
* refactor(multiple): default softDisabled to true Updates the default value of the input to across all ARIA components. This allows disabled items to receive focus by default, improving keyboard accessibility. - Grid focus coordinates behavior has also been updated to correctly handle focus when is enabled. * fix(cdk/a11y): update tests to reflect correct behavior * refactor(cdk/a11y): refine softDisabled behavior and update tests\n\nThis commit refines the behavior across several a11y components (List, Listbox, Accordion, Tree) to ensure correct interaction between disabled states and navigation/selection. Specifically:\n\n- In , the method now explicitly checks if the list is disabled before allowing selection updates, preventing unintended selections when permits navigation.\n- In , a new method is introduced to clearly distinguish between a 'hard' disabled state (blocking all interaction) and a 'soft' disabled state (allowing navigation but blocking selection).\n- Corresponding tests in , , , and have been updated and expanded to accurately reflect and verify these refined interactions, ensuring that navigation and selection behave as expected in various disabled scenarios. (cherry picked from commit 28a50f5)
Updates the default value of the input to across all ARIA components. This allows disabled items to receive focus by default.
softDisabledis true.Why should this be done?
https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_disabled_controls
(From W3C) For the following composite widget elements, keep them focusable when disabled:
It's good a11y practice for disabled items to still be focusable