angular / angular/components

feat(autocomplete): allow configuring requireSelection blur behavior without resetting value to null

Open
#32,953 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: material/autocomplete feature P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

Feature Description

Please add a configurable option such as preserving the previous selection on blur, so that requireSelection does not have to emit null unless the application explicitly wants that behavior.

Related issues:

  • #27767: requireSelection clears input on blur
  • #28590: [requireSelection]="true" breaks valueChanges
Use Case

In our case, we manually restore the previous selected value when Angular resets the control to null.

That workaround causes multiple valueChanges emissions for a single user interaction: first null, then the previously selected value after we restore it. This is noisy, annoying to handle, and not reliably distinguishable from a real clear action triggered by the user.

We want to detect an actual clear action separately from the case where the user only focuses the input, opens the autocomplete panel, and then blurs without selecting a new option. A configurable behavior here would prevent unnecessary state changes and extra reactive form events.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Angular autocomplete requireSelection blur behavior and how it emits valueChanges when the panel closes. Read related issues #27767 and #28590 for existing constraints. Done means applications can configure whether blur preserves the previous selection or emits null, while an explicit clear remains distinguishable.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.