Skip to content

Conversation

@priethor
Copy link
Contributor

What?

Always add the HStack wrapper to dataviews actions.

Why?

Right now, the horizontal wrapper is not added when there are only primary actions, which results in actions:

  • Stacking vertically.
  • Being always shown instead of only when hovering/selecting the row

How?

Adding the HStack unconditionally, and conditionally adding the dropdown menu.

Testing Instructions

  1. Before applying this patch, hack /packages/edit-site/src/components/post-list/index.js to only show primary actions with const actions = useMemo(() => [ editAction, ...postTypeActions ].filter( action => action.isPrimary )...);
  2. Go to the post list experiment, verify that all the actions show and are vertically stacked.
  3. Apply this PR
  4. Go to the post list experiment, verify that all actions show in a row and only when hovering/selecting.

Screenshots or screencast

Before After
image image

@priethor priethor self-assigned this Aug 20, 2025
@priethor priethor added [Type] Bug An existing feature does not function as intended [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Package] DataViews /packages/dataviews labels Aug 20, 2025
@priethor priethor requested review from mcsf and youknowriad August 20, 2025 14:55
@priethor priethor marked this pull request as ready for review August 20, 2025 14:55
@priethor priethor requested a review from oandregal as a code owner August 20, 2025 14:55
@github-actions
Copy link

github-actions bot commented Aug 20, 2025

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: priethor <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: mcsf <[email protected]>
Co-authored-by: oandregal <[email protected]>

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

Copy link
Contributor

@mcsf mcsf left a comment

Choose a reason for hiding this comment

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

Tests well, makes sense. Thanks for this.

@oandregal
Copy link
Member

oandregal commented Aug 20, 2025

Being always shown instead of only when hovering/selecting the row

I believe this was on purpose, otherwise it looks like there's nothing to interact with when there's only primary actions (see "after" screenshot). Before shipping, I'd welcome @jameskoster thoughts on this. Do we make the primary actions always visible when there are no secondary ones? or do we only display them on hover/select?

@priethor
Copy link
Contributor Author

it looks like there's nothing to interact with

That's a good point; note that the primary reason for this PR is preventing the vertical stacking, so it would make sense to show them without the need to hover.

@oandregal
Copy link
Member

note that the primary reason for this PR is preventing the vertical stacking, so it would make sense to show them without the need to hover.

Feel free to 🚢 when you're ready if the actions visibility works as in trunk. That change is a separate concern. I just wanted to double-check with design about that to avoid going back/forth every few months on this topic.

@github-actions
Copy link

Flaky tests detected in 5b7b9ff.
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/17102335240
📝 Reported issues:

@priethor priethor merged commit cc7c0c2 into trunk Aug 20, 2025
87 of 91 checks passed
@priethor priethor deleted the fix/always-wrap-dataviews-primary-actions branch August 20, 2025 18:20
@github-actions github-actions bot added this to the Gutenberg 21.5 milestone Aug 20, 2025
priethor added a commit that referenced this pull request Aug 20, 2025
@priethor
Copy link
Contributor Author

I missed the coauthoring, I owe you one 🤦 🙇

adamsilverstein pushed a commit to adamsilverstein/gutenberg that referenced this pull request Aug 20, 2025
…s#71274)

* Fix DataViews actions horizontal layout consistency

* Update changelog with this fix
@jameskoster
Copy link
Contributor

@oandregal good question. I think it's okay for now, and loosely similar to wp-admin (where actions only appear on hover/focus). But as DataViews are consumed more broadly across the new admin design we may need to revisit actions appearance and behaviors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Package] DataViews /packages/dataviews [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants