bug(aria/combobox): `filterMode="auto-select"` returns old value
维护者通常 1 天内回复
@ok7sai 已经在做这个了。
开始于 2026年4月1日。
评估
这个 Issue 还没有评估数据。
描述
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
angular/aria combobox with multi false, readonly false and filterMode="auto-select" returns old selected value.
If now we have AAA as selected but then we select BBB and hit Enter key -> we mustn't see AAA. Because we select another (BBB) value and approve it by Enter.
values():
<div>{{ listbox()?.values() | json }}</div>
<div ngCombobox [filterMode]="filterMode()" [readonly]="false">
<div #origin class="autocomplete">
<span
class="search-icon material-symbols-outlined"
translate="no"
aria-hidden="true"
>search</span
>
<input
aria-label="Label dropdown"
placeholder="Select a country"
[(ngModel)]="query"
ngComboboxInput
/>
</div>
<ng-template ngComboboxPopupContainer>
<ng-template
[cdkConnectedOverlay]="{origin, usePopover: 'inline', matchWidth: true}"
[cdkConnectedOverlayOpen]="true"
>
<div class="popup">
@if (countries().length === 0) {
<div class="no-results">No results found</div>
}
<div ngListbox [multi]="false">
@for (country of countries(); track country) {
<div ngOption [value]="country" [label]="country">
<span class="option-label">{{ country }}</span>
<span
class="check-icon material-symbols-outlined"
translate="no"
aria-hidden="true"
>check</span
>
</div>
}
</div>
</div>
</ng-template>
</ng-template>
</div>
import {
Combobox,
ComboboxInput,
ComboboxPopupContainer,
} from '@angular/aria/combobox';
import { Listbox, Option } from '@angular/aria/listbox';
import { OverlayModule } from '@angular/cdk/overlay';
import { CommonModule } from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
computed,
input,
signal,
viewChild,
viewChildren,
} from '@angular/core';
import { FormsModule } from '@angular/forms';
const ALL_COUNTRIES = ['AAA', 'BBB', 'CCC', 'DDD'];
@Component({
selector: 'CustomCombobox',
templateUrl: 'combobox.html',
styleUrl: './combobox.scss',
imports: [
CommonModule,
Combobox,
ComboboxInput,
ComboboxPopupContainer,
Listbox,
Option,
OverlayModule,
FormsModule,
],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CustomCombobox {
public filterMode = input.required<'manual' | 'auto-select' | 'highlight'>();
/** The combobox listbox popup. */
listbox = viewChild<Listbox<string>>(Listbox);
/** The options available in the listbox. */
options = viewChildren<Option<string>>(Option);
/** A reference to the ng aria combobox. */
combobox = viewChild<Combobox<string>>(Combobox);
/** The query string used to filter the list of countries. */
query = signal('');
/** The list of countries filtered by the query. */
countries = computed(() =>
ALL_COUNTRIES.filter((country) =>
country.toLowerCase().startsWith(this.query().toLowerCase())
)
);
constructor() {
}
}
Reproduction
StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-gopytywj?file=src%2Fmain.ts,src%2Fcombobox%2Fcombobox.html
Steps to reproduce:
- type aaa -> values() are ["AAA"]
- remove input value
- Now: empty input and values(). Use arrow up/down keys to select BBB, CCC or DDD. Not AAA
- hit Enter key
- But values() are ["AAA"] again
Expected Behavior
We select BBB and hit Enter key -> we must see BBB, not AAA.
Actual Behavior
We select BBB, CCC, DDD and hit Enter key -> we see previous value: AAA
Environment
- Angular: 21.0.3 and later
- angular/aria: 21.0.2 - 21.2.0-next.0
- Browser(s):
- Operating System (e.g. Windows, macOS, Ubuntu):
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 5 小时
- 30 天内合并 PR
- 67
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
angular/components 的其他 Issue
-
bug(aria/combobox): keys pressed back to back are lost; only the last one reaches the popup可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area: aria/combobox gemini-triaged
难度 2/5 1-3 小时 新手友好度 78/100
angular/components#33973 ·
维护者通常 1 天内回复
-
bug(aria/combobox): ComboboxPopup throws NG0950 when destroyed before its first change detection可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area: aria/combobox gemini-triaged
难度 2/5 1-3 小时 新手友好度 78/100
angular/components#33972 ·
维护者通常 1 天内回复
-
bug(material/sort): hover hint arrow on an unsorted header shows the active sort direction, not the resulting direction after click.可能已有人在做 @lekhmanrus 于 12 天前认领。 未关闭area: material/sort P3
难度 2/5 1-3 小时 新手友好度 70/100
angular/components#33933 ·
维护者通常 1 天内回复
-
bug(mat-date-picker): month shown twice in date picker可能已有人在做 @PreethiPantangi 于 29 天前认领。 未关闭area: material/datepicker P4
难度 2/5 1-3 小时 新手友好度 72/100
angular/components#33763 · 2 条评论 · 3 个 reaction ·
维护者通常 1 天内回复
-
Bug in table.scss footer cell height: unset instead of footer row height unset可能已有人在做 @minwookshin 于 16 天前认领。 未关闭area: material/table P4
难度 1/5 1 小时以内 新手友好度 88/100
angular/components#33709 · 1 条评论 ·
维护者通常 1 天内回复
查看 angular/components 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
getsentry/sentry-conventions#732 · 1 条评论 ·
维护者通常 1 天内回复
-
status:in-linear status:team-assigned team:nodes
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
motiondivision/motion#3955 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
equinor/prisma-decision-web#919 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 83/100