Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data grid] GridToolbarFilterButton and GridToolbarColumnsButton do not toggle (close) the preference panel on second click #17138

Open
lukas60055 opened this issue Mar 25, 2025 · 1 comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module!

Comments

@lukas60055
Copy link

lukas60055 commented Mar 25, 2025

Steps to reproduce

  1. Create a simple <DataGrid> with GridToolbarColumnsButton or GridToolbarFilterButton in the toolbar.
  2. Run the app using @mui/x-data-grid version 7.24.1 or later.
  3. Click the "Columns" (or "Filters") button in the toolbar — the preferences panel opens.
  4. Click the same button again — the panel does not close.

Expected behavior: the second click should close the panel (toggle behavior).
Actual behavior: nothing happens, the panel stays open.

Current behavior

Clicking the "Columns" or "Filter" toolbar button opens the preferences panel, but clicking the same button again does not close it.

This used to work before v7.24.1. The expected toggle behavior is broken.

Root cause is the use of event.stopPropagation() in onPointerUp, which blocks the ClickAwayListener from reacting to the second click.

Expected behavior

Clicking the "Columns" or "Filters" toolbar button should toggle the panel:

  • First click: opens the panel.
  • Second click: closes the panel.

This is intuitive UX and was the default behavior before version 7.24.1.

Context

I'm using the DataGrid toolbar in a production app. After updating to 7.28.x, users reported that they could open the filter/column panel, but clicking again on the same button no longer closes it.

I confirmed this is due to the stopPropagation() in the onPointerUp handler inside the toolbar buttons.

Workarounds (like using custom buttons and apiRef) exist, but the default MUI components should behave consistently and intuitively.

Removing stopPropagation() or providing a way to override it would solve the issue.

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: DataGrid toolbar toggle preference panel columns filters stopPropagation pointerup clickawaylistener

@lukas60055 lukas60055 added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 25, 2025
@michelengelen michelengelen changed the title GridToolbarFilterButton and GridToolbarColumnsButton do not toggle (close) the preference panel on second click [data grid] GridToolbarFilterButton and GridToolbarColumnsButton do not toggle (close) the preference panel on second click Mar 26, 2025
@michelengelen
Copy link
Member

Hey @lukas60055 and thanks for providing this detailed information. It seems this got introduced in #16276. I'll add it to the board for the team to have a look! 👍🏼

@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Mar 26, 2025
@michelengelen michelengelen added component: data grid This is the name of the generic UI component, not the React module! feature: Filtering Related to the data grid Filtering feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer feature: Filtering Related to the data grid Filtering feature labels Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module!
Projects
Status: 🆕 Needs refinement
Development

No branches or pull requests

2 participants