bug(aria/combobox): keys pressed back to back are lost; only the last one reaches the popup
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- angular, typescript
- Ambito
- accessibility, frontend
Direzione di ricerca
Inizia dall’implementazione della combobox ARIA di Angular, in ComboboxPattern, dove, secondo l’issue, viene impostato keyboardEventRelay e successivamente ridistribuito al target del controllo popup. Segui il gestore dei tasti e l’effetto di relay, poi aggiungi o aggiorna un test unitario per diversi eventi ArrowDown consecutivi. Il lavoro è completato quando ogni evento viene gestito in ordine e tre pressioni spostano la selezione di tre opzioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 5h
- PR unite (30g)
- 67
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di angular/components
-
bug(aria/combobox): ComboboxPopup throws NG0950 when destroyed before its first change detectionApertaarea: aria/combobox gemini-triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
angular/components#33972 ·
I maintainer di solito rispondono entro 1 giorno
-
bug(material/sort): hover hint arrow on an unsorted header shows the active sort direction, not the resulting direction after click.Forse già presa @lekhmanrus l’ha presa 11 giorni fa. Apertaarea: material/sort P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
angular/components#33933 ·
I maintainer di solito rispondono entro 1 giorno
-
bug(mat-date-picker): month shown twice in date pickerForse già presa @PreethiPantangi l’ha presa 29 giorni fa. Apertaarea: material/datepicker P4
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
angular/components#33763 · 2 commenti · 3 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Bug in table.scss footer cell height: unset instead of footer row height unsetForse già presa @minwookshin l’ha presa 15 giorni fa. Apertaarea: material/table P4
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
angular/components#33709 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
docs-bug(Table): Add example with `rowspan`Forse già presa @BHUVANSH855 l’ha presa 96 giorni fa. Apertaarea: material/table docs P4
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
angular/components#33455 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di angular/components
Issue simili
-
docs(api): openapi.yaml still documents gif-tools optimize colors as 2-256 instead of 2, 4, 16, 256Apertaarea: backend documentation priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
snapotter-hq/SnapOtter#2919 ·
I maintainer di solito rispondono entro 1 giorno
-
accepted :+1: bug db/redis
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
beekeeper-studio/beekeeper-studio#4882 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
ready-for-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
konflux-ci/konflux-ui#1630 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
ahmedkhaleel2004/gitdiagram#233 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
simkimsia/netlify-axi#19 ·
I maintainer di solito rispondono entro 1 giorno