DataViews: Add insert left/right in table column header - #72929
Conversation
|
The multiple arrow icons look a little clunky. I wonder if we should omit the icons for the 'Insert' actions. What do you think @WordPress/gutenberg-design ? |
|
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. |
|
@ntsekouras there's a CI failure because, since a few months ago, every PR to |
@oandregal, yes I'm aware. I'll do it later since I'm still waiting on the design feedback. |
|
If no other design feedback arrives I'd lean towards removing the icons for insert left/right. |
|
+1 to removing the icons. |
0f39873 to
8cd70d9
Compare
|
Flaky tests detected in f0f7678. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19142008744
|
f0f7678 to
8c7abda
Compare
|
I've rebased and updated the util used. I think it's worth it to try this out even with the context menu on table headers. What do you think @jameskoster @youknowriad? In other case, I'll close the PR. |
|
I still think it's a nice power-user feature, but happy to defer to other stronger opinions. |
|
No strong opinions for me :) |
8c7abda to
4069297
Compare
|
I've just noticed one thing: we need to disable insert left/right when there's no field hidden. Screen.Recording.2025-11-20.at.19.39.08.mov |
4069297 to
34ab755
Compare
Good catch. I fixed it. |
| </Menu.Item> | ||
| ) } | ||
| { canInsertLeft && ( | ||
| { canInsertLeft && !! hiddenFields.length && ( |
There was a problem hiding this comment.
Can we make it disabled if there are no fields to add?
There's a difference between a menu item that we should never display (e.g., never display insert left in the primary column, or never display left/right if the consumer has disabled moving) vs. a situational context (it's possible to insert fields, but there's none at the moment).
Going to tag @jameskoster for thoughts, but I'm approving in the meantime. It can be addressed as follow-up, if we want to implement what I suggested.
There was a problem hiding this comment.
Good question. I don't actually have a strong feeling about this so would welcome input from others.
My instinct is that after inserting the last option it's kind of implied that there's no further action to take, and therefore reasonable to hide rather than disable. On the other side of the coin, in a DataViews instance where all fields are visible by default, would a disabled 'Insert left' action be confusing?
34ab755 to
cd71889
Compare
What?
Resolves: #72844
This PR adds two menu items in
tablelayout that enables users to insert left or right one of the hidden fields.Notes
Testing Instructions
tableDataViews click the column header and play around with the new menu items (insert left / insert right)Screenshots or screencast