Skip to content

Commit

Permalink
DataViews: use action.disabled to disable action buttons (#68275)
Browse files Browse the repository at this point in the history
Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
  • 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

1 comment on commit 75ef79e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 75ef79e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12483213626
📝 Reported issues:

Please sign in to comment.