components
components copied to clipboard
bug(cdk/listbox): option remains active after tabbing out
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:
- use keyboard arrow keys to to move between list items
- tab out from the list
- observe
I am activeis 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