Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#32,953 2 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
angular, typescript
领域
frontend

调研方向

首先跟踪 Angular autocomplete 中 requireSelection 的 blur 行为,以及 panel 关闭时它如何发出 valueChanges。阅读相关 issue #27767 和 #28590,了解现有约束。完成标准是应用可以配置 blur 是保留之前的选择还是发出 null,同时显式清除仍可区分。

由索引模型根据 Issue 内容生成。

描述

area: material/autocomplete feature P3
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.

主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 1 小时
30 天内合并 PR
84

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

angular/components 的其他 Issue

查看 angular/components 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。