Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import {LiveAnnouncer} from '@angular/cdk/a11y';
import {COMMA, ENTER} from '@angular/cdk/keycodes';
import {ChangeDetectionStrategy, Component, computed, inject, model, signal} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {MatAutocompleteModule, MatAutocompleteSelectedEvent} from '@angular/material/autocomplete';
import {MatChipInputEvent, MatChipsModule} from '@angular/material/chips';
import {
MatAutocompleteModule,
type MatAutocompleteSelectedEvent,
} from '@angular/material/autocomplete';
import {type MatChipInputEvent, MatChipsModule} from '@angular/material/chips';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatIconModule} from '@angular/material/icon';

Expand All @@ -14,7 +17,9 @@ import {MatIconModule} from '@angular/material/icon';
selector: 'chips-autocomplete-example',
templateUrl: 'chips-autocomplete-example.html',
styleUrl: 'chips-autocomplete-example.css',
imports: [MatFormFieldModule, MatChipsModule, MatIconModule, MatAutocompleteModule, FormsModule],
// Make sure to import `MatAutocompleteModule` before `MatChipsModule` to prevent adding typed
// text when autocomplete option is selected via keyboard).
imports: [MatFormFieldModule, MatAutocompleteModule, MatChipsModule, MatIconModule, FormsModule],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ChipsAutocompleteExample {
Expand Down
5 changes: 4 additions & 1 deletion src/material/chips/chips.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ Users can press delete to remove a chip. Pressing delete triggers the `removed`

A `<mat-chip-grid>` can be combined with `<mat-autocomplete>` to enable free-form chip input with suggestions.

> _Please note: when using `MatChipsModule` together with `MatAutocompleteModule`, the order in which modules are imported matters._
> _To ensure correct behavior (e.g., preventing adding typed text when autocomplete option is selected via keyboard), make sure to import `MatAutocompleteModule` before `MatChipsModule`._

<!-- example(chips-autocomplete) -->

### Icons
Expand Down Expand Up @@ -141,7 +144,7 @@ The chips components support 3 user interaction patterns, each with its own cont

`<mat-chip-grid>` and `<mat-chip-row>` : These elements implement a grid accessibility pattern. Use them as part of a free form input that allows users to enter text to add chips.

Note : be sure to have the input element be a sibling of mat-chip-grid to ensure accessibility of the input element by accessibility devices such as Voice Control. It is also recommended to apply an appropriate `aria-label` to the input to optimize accessibility of the input.
> _Please note: be sure to have the input element be a sibling of `mat-chip-grid` to ensure accessibility of the input element by accessibility devices such as Voice Control. It is also recommended to apply an appropriate `aria-label` to the input to optimize accessibility of the input._

```html
<mat-form-field>
Expand Down
Loading