Skip to content

Conversation

@jameskoster
Copy link
Contributor

@jameskoster jameskoster commented Dec 10, 2025

What

Stop rendering FieldItem components for visible locked fields in the properties section of the DataViews view config.

Why

Visible locked fields are always visible and cannot be toggled off when they're already shown. Displaying them in the properties list adds unnecessary UI clutter and can confuse users since these items appear interactive but don't provide meaningful actions when visible.

How

Removed the visibleLockedFields.map() block that was rendering FieldItem components for visible locked fields. The visibleLockedFields variable is still calculated and used for logic (determining total visible fields count and preventing hiding when only one field is visible), but these items are no longer rendered in the UI. Hidden locked fields and regular fields continue to render as before.

Pages DataView Before Pages DataView After
Screenshot 2025-12-10 at 13 40 55 Screenshot 2025-12-10 at 13 44 10

Note there is no longer a 'Title' item in the menu because the Title field cannot be toggled on/off.

@github-actions
Copy link

github-actions bot commented Dec 10, 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: jameskoster <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: jasmussen <[email protected]>
Co-authored-by: oandregal <[email protected]>
Co-authored-by: fcoveram <[email protected]>

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

@jameskoster jameskoster added [Type] Enhancement A suggestion for improvement. [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond labels Dec 10, 2025
@jameskoster
Copy link
Contributor Author

An alternative approach here would be to keep the menu item visible, but make it disabled, or show a lock icon.

I decided to try hiding it altogether inspired by MacOS Finder which also hides untoggle-able items.

@jameskoster jameskoster requested a review from a team December 10, 2025 13:50
@jasmussen
Copy link
Contributor

Seems reasonable to me.

@github-actions
Copy link

Flaky tests detected in aaee500.
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/20101047876
📝 Reported issues:

@oandregal
Copy link
Member

This changes a few things:

  • title, media, description cannot be hidden, if present
  • it's not clear why sometimes you can hide the "last field", and sometimes you cannot

This is how it works in trunk (displays all fields visible, but cannot hide the last visible field):

Screen.Recording.2025-12-11.at.19.37.00.mov

This is how it works with this change (can hide any fields because there's title/media/description):

Screen.Recording.2025-12-11.at.19.33.27.mov

However, this is what happens when there is no title/media/description is provided (cannot hide the last field):

Screen.Recording.2025-12-11.at.19.34.21.mov

@jameskoster
Copy link
Contributor Author

@oandregal Good catch. Do you think it would make sense to simply disable the last visible field (when there's no title/media/description)? Is that possible?

@fcoveram
Copy link
Contributor

Showing it active and disabled makes sense to me.

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 [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants