Skip to content

Commit

Permalink
[DataGrid] Fix order of onClick prop on toolbar buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
KenanYusuf committed Jan 27, 2025
1 parent 21e98f7 commit 40f9aed
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ const GridToolbarColumnsButton = forwardRef<HTMLButtonElement, GridToolbarColumn
aria-expanded={isOpen}
aria-controls={isOpen ? columnPanelId : undefined}
startIcon={<rootProps.slots.columnSelectorIcon />}
onClick={showColumns}
{...rootProps.slotProps?.baseButton}
{...buttonProps}
onPointerUp={(event) => {
if (preferencePanel.open) {
event.stopPropagation();
}
buttonProps.onPointerUp?.(event);
}}
{...rootProps.slotProps?.baseButton}
{...buttonProps}
onClick={showColumns}
ref={ref}
>
{apiRef.current.getLocaleText('toolbarColumns')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ const GridToolbarDensitySelector = forwardRef<HTMLButtonElement, GridToolbarDens
aria-expanded={open}
aria-controls={open ? densityMenuId : undefined}
id={densityButtonId}
onClick={handleDensitySelectorOpen}
{...rootProps.slotProps?.baseButton}
{...buttonProps}
onClick={handleDensitySelectorOpen}
ref={handleRef}
>
{apiRef.current.getLocaleText('toolbarDensity')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ const GridToolbarExportContainer = forwardRef<
aria-haspopup="menu"
aria-controls={open ? exportMenuId : undefined}
id={exportButtonId}
onClick={handleMenuOpen}
{...rootProps.slotProps?.baseButton}
{...buttonProps}
onClick={handleMenuOpen}
ref={handleRef}
>
{apiRef.current.getLocaleText('toolbarExport')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,15 @@ const GridToolbarFilterButton = forwardRef<HTMLButtonElement, GridToolbarFilterB
<rootProps.slots.openFilterButtonIcon />
</rootProps.slots.baseBadge>
}
{...rootProps.slotProps?.baseButton}
{...buttonProps}
onClick={toggleFilter}
onPointerUp={(event) => {
if (preferencePanel.open) {
event.stopPropagation();
}
buttonProps.onPointerUp?.(event);
}}
{...rootProps.slotProps?.baseButton}
{...buttonProps}
ref={ref}
>
{apiRef.current.getLocaleText('toolbarFilters')}
Expand Down

0 comments on commit 40f9aed

Please sign in to comment.