mui / mui/material-ui

Snackbar slotProps.clickAwayListener not working

Open
#46,417 6 comments 1 reaction 1 assignee View on GitHub

Nobody has claimed this yet.

scope: toast type: expected behavior
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Steps to reproduce

Steps:

  1. Open this link to live example: https://stackblitz.com/edit/efjokxw3?file=src%2FDemo.tsx
  2. Click twice on any button.
Current behavior

On the second click, two things are happening:

  1. The clickAwayListener still works, despite disabling it
  2. The second click should display a snackbar, but the clickAwayListener overrides it
Expected behavior
  1. It should disable the clickAwayListener.
  2. Even if the clickAwayListener is not disabled (omitting slotProps entirely), it should not "override" displaying another snackbar.
Context

No response

Your environment
npx @mui/envinfo
  System:
    OS: Windows 10 10.0.19045
  Binaries:
    Node: 22.16.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.4.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: Not Found
  Browsers:
    Chrome: 137.0.7151.120
    Edge: Chromium (137.0.3296.83)

Search keywords: snackbar clickaway clickawaylistener

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.