[data grid] GridToolbarFilterButton
and GridToolbarColumnsButton
do not toggle (close) the preference panel on second click
#17138
Labels
bug 🐛
Something doesn't work
component: data grid
This is the name of the generic UI component, not the React module!
Steps to reproduce
<DataGrid>
withGridToolbarColumnsButton
orGridToolbarFilterButton
in the toolbar.@mui/x-data-grid
version7.24.1
or later.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()
inonPointerUp
, which blocks theClickAwayListener
from reacting to the second click.Expected behavior
Clicking the "Columns" or "Filters" toolbar button should toggle 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 theonPointerUp
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
Search keywords: DataGrid toolbar toggle preference panel columns filters stopPropagation pointerup clickawaylistener
The text was updated successfully, but these errors were encountered: