angular / angular/components

feat(Material Select) - Way to set first option active manually

Offen
#21,375 3 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/select feature P4
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

#### Way to set first option as active manually in Material Select

The feature to let first option active in the options displayed using material select.
i.e. One should be able to manually/programmatically set the first option in the dropdown as active.

#### Use Case

While implementing search filter using Material Select component ( i.e. using an Input element within mat-select ) the active item toggles based on the default behaviour of keyboard interaction i.e. it sets the item active as per the matching character user has pressed on keyboard. This causes inconsistency while implementing custom filtering and may lead disturbance in the focus as per UX perspective.

The feature for manually setting the first option active can help resolve the above scenario.

Tried using `this.matSelect._keyManager.setFirstItemActive();` (matSelect is of type Material Select) but the default search behaviour causes inconsistency and sometimes option other than the first option gets active

**Sample demo for Drop Down Search using Material Select :**
https://stackblitz.com/edit/angular-ivy-q1bvhb

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der verknüpften StackBlitz-Reproduktion und untersuche die Tastaturinteraktion von Material Select sowie das Verhalten der aktiven Option. Ermittle, wie ein Consumer die erste gefilterte Option manuell aktiv machen könnte, ohne dass das standardmäßige Suchverhalten sie überschreibt. Als erledigt gilt die Aufgabe, wenn das angeforderte Verhalten konsistent bereitgestellt und für den Anwendungsfall der benutzerdefinierten Filterung abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.