Skip to content

bug(Autocomplete): requireSelection Fails After Selection & Value Change #28432

Closed
@lperezprimemso

Description

@lperezprimemso

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

After selecting an option from autocomplete before the focus is lost, if a single character is deleted, the component will not clear out the input and deselect the option. If two or more characters are deleted, the component works as normal.

Reproduction

StackBlitz link: https://material.angular.io/components/autocomplete/overview#require-an-option-to-be-selected
Steps to reproduce:

  1. Click into autocomplete input.
  2. Select an option.
  3. Before losing focus on input, backspace once.
  4. Navigate away from input.
  5. Partial value will remain with the option still selected.

Expected Behavior

If user modifies value when requireSelection is set to true, the value on the input should always clear and the selected option should be deselected.

Actual Behavior

Value on input is not cleared and the option is not deselected.

Environment

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

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/autocomplete

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions