DataViews: Add a context menu when right clicking on the table header#73104
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. |
| return !! item; | ||
| } | ||
|
|
||
| export function PropertiesSection( { |
There was a problem hiding this comment.
no big change here outside the new showLabel prop, all the rest is the same previous component no change.
|
Size Change: +423 B (+0.02%) Total Size: 2.47 MB
ℹ️ View Unchanged
|
|
@ntsekouras we could have both. Your PR is a bit better from an a11y perspective as it makes this feature available to keyboard users. Although having said that it's already available in the appearance options panel, so I can go either way on this :) |
|
@youknowriad Couldn't we use Menu here? It handles/offers everything we want in a consistent way. The styling as-is seems a bit broken, double border, strokes between items:
|
|
@jameskoster This uses the same component as the one used in the view config dropdown, I think ideally we'd have a lower level abstraction than Menu that can be used for both within Maybe @aduth can talk about how we can do this. |
|
Yes we've spoken a few times about Menus that appear 'inline' in other UIs, but didn't have a valid use case yet so it hasn't been prioritised. There's also potential overlap with navigation menus to consider as well. But in this case doesn't it seem like |
No, it's not possible the Menu renders contextually to a button not to the mouse position. We might need a dedicated |
I would love thoughts from @aduth on how to go about this, I think the way we make styles match is by using the "inline menu" component. |
|
I think we'll want to have a dedicated With how Menu is currently implemented, it's not currently possible to use it like how we're using Popover here to arbitrarily position the menu. A realistic short-term solution could be one of:
Another option that could be done today without changes to Menu would be to interact with the menu's internal store to assign an anchor element. I don't love this though, since ideally I don't think we'd be exposing the internal, library-specific context store for external usage. I think we should change this, because otherwise it binds us to a specific implementation. |
|
As far as the reusing parts between the config menu and the context menu, I'm not sure these are the same kind of thing, since the context menu items feel more like |
|
As a user, I feel like this is the same thing. I'm selecting which fields are available. If the UI is triggered using right click or a trigger (the view config dropdown trigger) feels really secondary. |
|
In discussing with Andrew I came to realize something:
Now, I'm strongly convinced that this is not a checkbox. We actually store this as |
|
If you're strongly convinced then so am I :) It would still be nice to fix the styling in the context menu though 😄 |
|
Yeah, I think we should fix the styling ideally in a reusable UI component that we can use between both context. What would be the desired style here? |
|
Just to be sure we're talking about the same thing, are you saying it's a If so we already have a design for that here: #65801 which can serve as a starting point. I should note that the 'checkboxes' in that concept are not |
|
I was thinking about the default browser multi-select (without aria), but it may correspond to the listbox pattern, I don't know to be honest. I would love for this component to live in the new UI package if possible yes :) |
|
You mean |
|
@jameskoster I was not saying that we should be using it as is and style it, instead I was saying that it's the same semantics for me. |
|
I experimented a bit with the listbox idea to determine feasibility and effort. FeasibilityOne design implication I noticed for using the listbox pattern in isolation (i.e. "inline") is that we'll need a focus ring on the entire list to indicate that it's a composite widget with a single tab stop. Is that ok? This detail hasn't been captured in existing mockups.
EffortWe'll likely need to build this as a custom component using Ariakit I was hoping we could simply render the listbox in Base UI Alternative:
|
|
On the context menu side, I agree with @aduth that we can have a dedicated |
|
I think @mtias have some strong feelings here about the design being very light (no actual checkbox, but an icon) and I'm not sure about the whole focus ring, that feels very weird to me to be honest. |
|
@simison I swear I though I fixed this using |
|
Huh, now I refreshed the page and it works again! Maybe some styles were still loading from the old version. I'll let you know if I see it again! |
|
@mirka I know we've discussed a lot when to use checkbox-appearance vs. plain icon but I can't remember all the details 😅 Do you think a plain icon could work in Also, could it be appropriate for the focus ring appear on I still think a checkboxgroup would be a better fit for the appearance config popover 🙊 |
It all started from It's tricky. Not all contexts require a clear differentiation between single/multiple, but in the few cases where it is needed, we can't differentiate them without a consistent cue that's already been established across the system 😅 Given the difficulties we're starting to see with the checkbox-style indicators, I can think of two paths forward:
Same! Would you be fine with that @youknowriad? |
what would do that look like? I think @mtias kind of feels strongly about this menu looking very similar to finder's columns menu. I'm not the one to convince here :) |
|
Wasn't that mostly about the context menu? I agree that should be minimal, basically a Menu with checkboxes instance. The popover would look like the mockup in this comment. |
I think it was for both (AFAIK) |
It's not that we weren't fully committed, we just haven't made all the changes in code yet 😄 So, given that this is a decision we can reverse later without major disruption, how about we revert all our "checkbox-style indicator" plans for now, and see how that goes? Plain checkmark indicators for both single and multiple selection — in all menus, selects, and comboboxes. |






What?
Extracts the DataViews properties section into a reusable component and adds a right-click context menu on the table layout header to access field visibility controls.
Why?
Users need quick access to show/hide fields when working with DataViews tables. Previously, this was only available through the view config dropdown. This also matches other tools like the MacOS finder.
Testing Instructions
- Right-click anywhere on the table header row
- Verify the properties menu appears at the cursor position
- Click on checkboxes to show/hide fields
- Verify the table updates immediately