Skip to content

Conversation

@tjshiu
Copy link
Contributor

@tjshiu tjshiu commented Nov 3, 2025

Updates the default value of the input to across all ARIA components. This allows disabled items to receive focus by default.

  • Updates the tests to also reflect new default behavior
  • Some a11y patterns where additional tests added
  • Also fixes an issue with navigation that was previously missed - Grid focus coordinates behavior has also been updated to correctly handle focus when softDisabled is true.

Why should this be done?

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.
@tjshiu tjshiu requested a review from a team as a code owner November 3, 2025 06:24
@tjshiu tjshiu requested review from ok7sai and wagnermaciel and removed request for a team November 3, 2025 06:24
@tjshiu tjshiu added the Accessibility This issue is related to accessibility (a11y) label Nov 3, 2025
/** 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()) {
Copy link
Member

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

  1. If a grid/list is disabled, then no cells/items can be focused when softDisabled sets to true, or
  2. if a grid/list is disabled, cells/items can still be focused when softDisabled sets to true

Copy link
Contributor Author

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 */
Copy link
Member

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.

@tjshiu tjshiu added target: rc This PR is targeted for the next release-candidate action: merge The PR is ready for merge by the caretaker labels Nov 4, 2025
@tjshiu tjshiu removed the request for review from wagnermaciel November 4, 2025 18:20
@tjshiu tjshiu merged commit 28a50f5 into angular:main Nov 4, 2025
26 of 28 checks passed
@tjshiu
Copy link
Contributor Author

tjshiu commented Nov 4, 2025

This PR was merged into the repository. The changes were merged into the following branches:

tjshiu added a commit that referenced this pull request Nov 4, 2025
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accessibility This issue is related to accessibility (a11y) action: merge The PR is ready for merge by the caretaker area: cdk/a11y target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants