Skip to content

Chip delete icon calls event.stopPropagation() #47234

@caillou

Description

@caillou

Steps to reproduce

Image

Steps:

  1. Open this link to live example: https://stackblitz.com/edit/ob1sd6fc?file=src%2FDemo.tsx
  2. Click on Open Popper button.
  3. Click on the x icon in the <Chip />.

Current behavior

The <Popper /> is not closed when clicking on the x icon if the <Chip />.

Expected behavior

Given the <ClickAwayListener /> in the <Popper />, the <Popper /> should be closed when clicking anywhere else, including when clicking on the x icon if the <Chip />.

Context

I use a <ClickAwayListener /> to close a <Popper />. Given that the <Chip /> event handler calls stopPropagation(), the click event never reaches the <ClickAwayListener />.

It seems like stopping propagation could be done by the onDelete handler that's passed into the Chip, rather than by default.

Your environment

npx @mui/envinfo
  System:
    OS: Linux 5.0 undefined
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    @emotion/react: latest => 11.14.0 
    @emotion/styled: latest => 11.14.1 
    @mui/core-downloads-tracker:  7.3.5 
    @mui/material: latest => 7.3.5 
    @mui/private-theming:  7.3.5 
    @mui/styled-engine:  7.3.5 
    @mui/system:  7.3.5 
    @mui/types:  7.4.8 
    @mui/utils:  7.3.5 
    @types/react: latest => 19.2.2 
    react: latest => 19.2.0 
    react-dom: latest => 19.2.0 
    typescript: latest => 5.9.3 

Search keywords: stopPropagation propagation Chip ClickAwayListener

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: chipChanges related to the chip.type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions