-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
DataViews list layout: hide actions menu when there is only one action and is primary #67015
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -175,6 +175,8 @@ function ListItem< Item >( { | |||
}; | |||
}, [ actions, item ] ); | |||
|
|||
const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this checks actions
, not eligibleActions
. This is intentional to make sure that we only hide the item menu when all the items has a single action. We wouldn't want to show only the icon for some and the icon + the actions menu for others.
Flaky tests detected in 3fb8ef7. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11843760531
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected ✅
P.S. Nitpick: The Array.filter
will always return an array. There's no need for optional chaining on this line.
primaryAction: _primaryActions?.[ 0 ], |
👍 Pushed 6f9eaff |
Part of #65165
What?
This PR hides the actions menu for the DataViews list layout when there's only 1 action and is primary.
All current core screens have more than one action. See testing instructions below.
Why?
To improve UX.
How?
Testing Instructions
This is something we've heard from extenders. Because there's no place in core where we have this situation just yet, we have to create one for testing:
postTypeActions
in this line and in the line below (in both arrays).Screen.Recording.2024-11-14.at.19.59.25.mov