Skip to content
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

bug(cdk/listbox): Keyboard focus is not follow ARIA doc #25833

Closed
1 task
zizifn opened this issue Oct 19, 2022 · 1 comment · Fixed by #26174
Closed
1 task

bug(cdk/listbox): Keyboard focus is not follow ARIA doc #25833

zizifn opened this issue Oct 19, 2022 · 1 comment · Fixed by #26174
Assignees
Labels
Accessibility This issue is related to accessibility (a11y) area: cdk/listbox P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@zizifn
Copy link
Contributor

zizifn commented Oct 19, 2022

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

N/A

Description

@angular/cdk/listbox is not follow ARIA Keyboard Interaction. https://www.w3.org/WAI/ARIA/apg/patterns/listbox/#listbox_kbd_interaction

If an option is selected before the listbox receives focus, focus is set on the selected option.

But cdk/listbox always go to last focus item. BTW, the <mat-list> is follow the ARIA doc,

Reproduction

Steps to reproduce:

  1. visit https://material.angular.io/cdk/listbox/examples#cdk-listbox-reactive-forms
  2. tab into list and select C++
  3. arrow down into JavaScript
  4. tab out to list
  5. shift+ tab into list

the example is single selection list box, but multiple selection list box also has some issue.

Expected Behavior

shift+ tab into list, should go to selected item C++

Actual Behavior

shift+ tab into list, go to last focus item which is JavaScript

Environment

  • Angular: 14.2.0
  • CDK/Material: 14.2.3
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@zizifn zizifn added the needs triage This issue needs to be triaged by the team label Oct 19, 2022
@zizifn zizifn changed the title bug(cdk/listbox): Keyboard focus is not follow ARIA bug(cdk/listbox): Keyboard focus is not follow ARIA doc Oct 19, 2022
@zarend zarend added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent Accessibility This issue is related to accessibility (a11y) area: cdk/listbox and removed needs triage This issue needs to be triaged by the team labels Oct 24, 2022
@crisbeto crisbeto self-assigned this Nov 28, 2022
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 3, 2022
Fixes that the listbox was setting the initial focus on a deselected option when a selected one was available.

**Note:** this fix is a bit more convoluted that it needs to be. E.g. ideally we would just focus the selected option when the listbox receives focus. We can't do that, because the listbox supports two different focus management modes: focus and `aria-activedescendant`. The former doesn't allow tabbing to the listbox.

Fixes angular#25833.
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 4, 2022
Fixes that the listbox was setting the initial focus on a deselected option when a selected one was available.

**Note:** this fix is a bit more convoluted that it needs to be. E.g. ideally we would just focus the selected option when the listbox receives focus. We can't do that, because the listbox supports two different focus management modes: focus and `aria-activedescendant`. The former doesn't allow tabbing to the listbox.

Fixes angular#25833.
crisbeto added a commit that referenced this issue Dec 5, 2022
Fixes that the listbox was setting the initial focus on a deselected option when a selected one was available.

**Note:** this fix is a bit more convoluted that it needs to be. E.g. ideally we would just focus the selected option when the listbox receives focus. We can't do that, because the listbox supports two different focus management modes: focus and `aria-activedescendant`. The former doesn't allow tabbing to the listbox.

Fixes #25833.
crisbeto added a commit that referenced this issue Dec 5, 2022
Fixes that the listbox was setting the initial focus on a deselected option when a selected one was available.

**Note:** this fix is a bit more convoluted that it needs to be. E.g. ideally we would just focus the selected option when the listbox receives focus. We can't do that, because the listbox supports two different focus management modes: focus and `aria-activedescendant`. The former doesn't allow tabbing to the listbox.

Fixes #25833.

(cherry picked from commit f99af6d)
wagnermaciel pushed a commit to wagnermaciel/components that referenced this issue Dec 9, 2022
Fixes that the listbox was setting the initial focus on a deselected option when a selected one was available.

**Note:** this fix is a bit more convoluted that it needs to be. E.g. ideally we would just focus the selected option when the listbox receives focus. We can't do that, because the listbox supports two different focus management modes: focus and `aria-activedescendant`. The former doesn't allow tabbing to the listbox.

Fixes angular#25833.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility This issue is related to accessibility (a11y) area: cdk/listbox P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants