-
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 table layout: hide actions menu when there is only one action and is primary #67020
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. |
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 advertised ✅
primaryActions: Action< Item >[], | ||
actions: Action< Item >[] | ||
) { | ||
return primaryActions.length === 1 && actions.length; |
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.
Why not inline the check?
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.
That could work as well. No big feelings either way. I suppose I thought it better to have it explain the why.
Noting that we do this for every layout and not only for I was a bit confused that |
This is actually only for the table. Here's the PR for the list #67015 :) The list view uses the subcomponents directly to handle the keyboard interactions. The grid is unaffected because it uses the compact view (no primary actions visible). This can be tested by switching to any other layout during testing.
|
Exactly. If grid wasn't using the compact and had one primary action would have the same behavior. For now it doesn't, but when we open the API for registering layouts, this behavior will be for any layout. |
@ntsekouras Agreed. If things worked differently then yes, it'd make sense to change the changelog/issue title to be about all the layouts. I just worry that it'd be confusing to say so when it's not true right now? Not sure how it could be improved without being confusing, but happy to explore alternatives if you have any suggestion. |
The title is not that important right now, yes. We should keep this in mind when creating the API for layouts to document it. |
Part of #65165
What?
This PR hides the actions menu for the DataViews table 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.
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).