Skip to content

bug(matChipRemove): matChipRemove does not preventDefault() #24436

Closed

Description

@max-vogler

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

matChipRemove does not preventDefault(), allowing standard click behavior like following a parent hyperlink to trigger. matChipRemove does stopPropagation() though.

Reproduction

Steps to reproduce: https://stackblitz.com/edit/components-issue-va7p6c?file=src%2Fapp%2Fexample-component.html

<mat-chip-list>
  <a href="https://example.org">
    <mat-chip>example.org <mat-icon matChipRemove>close</mat-icon></mat-chip>
  </a>
</mat-chip-list>

Expected Behavior

Clicking on matChipRemove should fully consume the event, including preventDefault().

Actual Behavior

Clicking on matChipRemove triggers the parent hyperlink.

Environment

  • Angular: 12.2.9
  • CDK/Material: 12.2.9
  • Browser(s): Chrome 98
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS 12.2

Activity

  1. added
    needs triage
    on Feb 17, 2022
  2. added
    P4
    and removed
    needs triage
    on Feb 21, 2022
  3. added 2 commits that reference this issue on Apr 2, 2022
    c10e47f
    d51f98d
  4. self-assigned this
    on Apr 3, 2022
  5. added 2 commits that reference this issue on Apr 12, 2022
    3660530
    6c65b1d
  6. angular-automatic-lock-bot commented on May 13, 2022

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P4area: material/chips

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions