Skip to content

Commit

Permalink
DataViews: use action.disabled to disable action buttons (WordPress…
Browse files Browse the repository at this point in the history
…#68275)

Co-authored-by: oandregal <[email protected]>
Co-authored-by: youknowriad <[email protected]>
  • Loading branch information
3 people authored Dec 24, 2024
1 parent 2ae525f commit 75ef79e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ function ButtonTrigger< Item >( {
<Button
label={ label }
icon={ action.icon }
disabled={ !! action.disabled }
accessibleWhenDisabled
isDestructive={ action.isDestructive }
size="compact"
onClick={ onClick }
Expand All @@ -90,7 +92,7 @@ function MenuItemTrigger< Item >( {
const label =
typeof action.label === 'string' ? action.label : action.label( items );
return (
<Menu.Item onClick={ onClick }>
<Menu.Item disabled={ action.disabled } onClick={ onClick }>
<Menu.ItemLabel>{ label }</Menu.ItemLabel>
</Menu.Item>
);
Expand Down
4 changes: 4 additions & 0 deletions packages/dataviews/src/dataviews-layouts/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ function PrimaryActionGridCell< Item >( {
render={
<Button
label={ label }
disabled={ !! primaryAction.disabled }
accessibleWhenDisabled
icon={ primaryAction.icon }
isDestructive={ primaryAction.isDestructive }
size="small"
Expand All @@ -124,6 +126,8 @@ function PrimaryActionGridCell< Item >( {
render={
<Button
label={ label }
disabled={ !! primaryAction.disabled }
accessibleWhenDisabled
icon={ primaryAction.icon }
isDestructive={ primaryAction.isDestructive }
size="small"
Expand Down

0 comments on commit 75ef79e

Please sign in to comment.