From b12018a25e25a26999ee4aa276a7fe02c0cb390e Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Fri, 10 Sep 2021 14:03:50 +0200 Subject: [PATCH] fix(material/chips): handle matChipRemove set on a button (#23538) Fixes that `matChipRemove` looked off when it's set on a `button` element. Also updates all the examples to use buttons. Note that we don't need any extra logic, because the `MatChipRemove` directive already sets `type="button"` when it's applied to a `button` element. Fixes #23463. (cherry picked from commit bb9c36bc89c2a4bd793ba03deae6d2c8ea4bfe1b) --- .../chips-autocomplete-example.html | 4 +- .../chips-input/chips-input-example.html | 4 +- src/dev-app/chips/chips-demo.html | 40 ++++++++++++++----- src/dev-app/mdc-chips/mdc-chips-demo.html | 28 +++++++++---- src/material-experimental/mdc-chips/README.md | 4 +- .../mdc-chips/chips.scss | 15 +++++++ src/material/chips/chips.scss | 16 ++++++-- 7 files changed, 88 insertions(+), 23 deletions(-) diff --git a/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.html b/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.html index f36a92db19e2..bd2e6718abe5 100644 --- a/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.html +++ b/src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.html @@ -7,7 +7,9 @@ [removable]="removable" (removed)="remove(fruit)"> {{fruit}} - cancel + {{fruit.name}} - cancel + Advanced With Events - cancel +
{{message}}
@@ -39,12 +41,16 @@

With avatar and icons

home Home - cancel + P Portel - cancel + @@ -54,7 +60,9 @@

With avatar and icons

Koby - cancel + @@ -69,7 +77,9 @@

With avatar and icons

Husi - cancel + @@ -104,7 +114,9 @@

Form Field

{{person.name}} - cancel + Form Field {{person.name}} - cancel + Form Field {{person.name}} - cancel + @@ -185,7 +201,9 @@

NgModel with chip list

{{aColor.name}} - cancel + @@ -196,7 +214,9 @@

NgModel with single selection chip list

{{aColor.name}} - cancel + diff --git a/src/dev-app/mdc-chips/mdc-chips-demo.html b/src/dev-app/mdc-chips/mdc-chips-demo.html index 90c30a8c8147..d5f947051f45 100644 --- a/src/dev-app/mdc-chips/mdc-chips-demo.html +++ b/src/dev-app/mdc-chips/mdc-chips-demo.html @@ -25,13 +25,17 @@

With avatar, icons, and color

home Home - cancel + P Portel - cancel + @@ -41,7 +45,9 @@

With avatar, icons, and color

Koby - cancel + @@ -56,7 +62,9 @@

With avatar, icons, and color

Husi - cancel + @@ -77,7 +85,9 @@

With Events

With Events - cancel +
{{message}}
@@ -142,7 +152,9 @@

Input is last child of chip grid

(removed)="remove(person)" (edited)="edit(person, $event)"> {{person.name}} - cancel + Input is next sibling child of chip grid {{person.name}} - cancel + ` with ``: {{person.name}} - cancel +