Skip to content

MatSelectionList steals focus when selection options are removed. #13528

@simon-bar

Description

@simon-bar

Bug, feature request, or proposal:

I think it could be considered a bug, but I would classify it as a feature request: adding a configuration option to control the _keyManager's behavior, or at least its skipPredicate:

https://github.com/angular/material2/blob/master/src/lib/list/selection-list.ts#L341

What is the expected behavior?

The list shouldn't steal focus whenever it wants.

What is the current behavior?

I modify the contents of the list based on an input the user is filling in. The list focuses its elements and it is impossible for the user to continue typing. Setting up the skipPredicate with childComponent._keyManager.skipPredicate(() => true) allowed me to hack out the desired behavior.

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.

StackBlitz starter: https://goo.gl/wwnhMV

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Is there anything else we should know?

If relevant, I can handle coding it up :)

Metadata

Metadata

Assignees

Labels

AccessibilityThis issue is related to accessibility (a11y)GThis is is related to a Google internal issueP3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions