WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.53k stars 4.21k forks source link

DataViews: fix action visibility logic #67197

Closed oandregal closed 20 hours ago

oandregal commented 21 hours ago

Follow-up to https://github.com/WordPress/gutenberg/pull/67020#discussion_r1851538821

What?

This fixes a bug that hid the action menu, even when there was seconday actions.

How?

Fix the visibility logic so that it hides the action menu only when there's a single action and is primary, as it was originally intended.

Testing Instructions

npm install && npm run storybook:dev

Go to the storybook and visit the default story for dataviews. It should display both the primary action (delete) and the action menu with two actions. In trunk it only displays the primary action.

Screenshot 2024-11-21 at 11 37 19

Then, go to this line and remove the secondary action so the actions array only contains the id: delete action. The expected behaviour is that the action menu is hidden in this case:

Screenshot 2024-11-21 at 11 39 36
github-actions[bot] commented 21 hours ago

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.