bug(aria/combobox): keys pressed back to back are lost; only the last one reaches the popup
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- angular, typescript
调研方向
从 Angular 的 ARIA combobox 实现中的 ComboboxPattern 入手。issue 指出,keyboardEventRelay 在此处被设置,随后重新分发到 popup control target。跟踪按键处理程序和 relay effect,然后为多个连续的 ArrowDown 事件添加或更新单元测试。完成标准是每个事件都按顺序处理,按三次会移动三个选项。
由索引模型根据 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
While the popup is open, ComboboxPattern relays navigation and typeahead keys to the popup through a signal: the key handler does this.keyboardEventRelay.set(e), and an effect later re-dispatches the event on the popup's control target. If a second key arrives before the effect runs, the signal is overwritten and the first key is never relayed.
Effects:
- Down, Down, Down pressed quickly moves the active option once.
- Typeahead loses characters: with options
item,item-2,item-3, typingitem-3with no delay between keys lands onitem; with 60 ms between keys it lands onitem-3. - Test automation and tools that send keys in a burst (and some assistive technology input) see wrong results. Seen in Chromium through Playwright, and in unit tests.
Related: #33361 (same relay signal, different symptom: a stale event replayed on reopen).
Reproduction
import { Component } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { Combobox, ComboboxPopup, ComboboxWidget } from '@angular/aria/combobox';
import { Listbox, Option } from '@angular/aria/listbox';
@Component({
imports: [Combobox, ComboboxPopup, ComboboxWidget, Listbox, Option],
template: `
<div ngCombobox #combobox="ngCombobox" tabindex="0">Pick one</div>
<ng-template ngComboboxPopup [combobox]="combobox">
<div ngListbox ngComboboxWidget #listbox="ngListbox" focusMode="activedescendant"
[activeDescendant]="listbox.activeDescendant()">
@for (o of options; track o) {
<div ngOption [value]="o" [label]="o">{{ o }}</div>
}
</div>
</ng-template>
`,
})
class Repro {
options = ['alpha', 'bravo', 'charlie', 'delta'];
}
const key = (el: Element, k: string) =>
el.dispatchEvent(new KeyboardEvent('keydown', { key: k, bubbles: true }));
it('handles each key pressed back to back', async () => {
const fixture = TestBed.createComponent(Repro);
await fixture.whenStable();
const combobox = fixture.nativeElement.querySelector('[ngCombobox]');
combobox.focus();
key(combobox, 'ArrowDown'); // open
await fixture.whenStable();
key(combobox, 'Home');
await fixture.whenStable();
key(combobox, 'ArrowDown');
key(combobox, 'ArrowDown');
key(combobox, 'ArrowDown');
await fixture.whenStable();
const id = combobox.getAttribute('aria-activedescendant');
expect(fixture.nativeElement.querySelector(`[id="${id}"]`).textContent.trim())
.toBe('delta'); // actual: 'bravo'
});
Expected Behavior
Each key event is handled, in order. Three Down presses move three options.
Actual Behavior
Only the last key since the effect last ran is relayed. Three Down presses move one option ("bravo" in place of "delta").
A possible fix: relay each event synchronously from the key handler (or queue them), not through a single-value signal.
Environment
- Angular: 22.2.1
- CDK/Material: @angular/cdk 22.2.3, @angular/aria 22.2.3 (also in 22.3.0-next.2 and
main) - Browser(s): Chromium (Playwright); Vitest with happy-dom
- Operating System (e.g. Windows, macOS, Ubuntu): macOS
- 主要语言
- 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): 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 天内回复
-
docs-bug(Table): Add example with `rowspan`可能已有人在做 @BHUVANSH855 于 97 天前认领。 未关闭area: material/table docs P4
难度 2/5 1-3 小时 新手友好度 72/100
angular/components#33455 ·
维护者通常 1 天内回复
查看 angular/components 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
equinor/prisma-decision-web#919 ·
维护者通常 1 天内回复
-
[DC] OneLogin sync imports a partial user list when an API request fails可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
bitwarden/directory-connector#1276 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
home-assistant/installer#324 ·
维护者通常 1 天内回复
-
Mondriaan
难度 2/5 1-3 小时 新手友好度 65/100
knaw-huc/textannoviz#733 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复