components icon indicating copy to clipboard operation
components copied to clipboard

bug(cdk/listbox): option remains active after tabbing out

Open chintankavathia opened this issue 1 year ago • 0 comments

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

No response

Description

I am not sure if this is an intended behaviour or a bug.

When tabbing out without selecting any option within cdkListBox it doesn't reset the active option and when user again come back to the listbox it focuses the last active item. Also the behaviour is different when we have multiple options selected and in that case it automatically resets the active option to first selected option.

Reproduction

StackBlitz link: https://stackblitz.com/edit/v4ybze?file=src%2Fexample%2Fcdk-listbox-activedescendant-example.html,src%2Fexample%2Fcdk-listbox-activedescendant-example.ts Steps to reproduce:

  1. use keyboard arrow keys to to move between list items
  2. tab out from the list
  3. observe I am active is present on last focused option

Expected Behavior

There should be an option to choose whether option should remain active after focus out.

Actual Behavior

last focused option remains active after tabbing out from list if no option is selected.

Environment

  • Angular: 18.2
  • CDK/Material: 18.2
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS

chintankavathia avatar Oct 11 '24 11:10 chintankavathia