Skip to content

Conversation

@jorgefilipecosta
Copy link
Member

This PR Adds a fallback placeholder for empty panel fields when labelPosition is set to none.

Why?

When a DataForm panel field has labelPosition: none and the field value is empty, the summary button renders with no content, collapsing to zero width. This makes the field inaccessible since there's nothing to click to open the panel. There is no way a use can open the field panel and make the field not empty.

How?

Display "(Empty field)" text when labelPosition === 'none' and all summary field values are empty.

Testing

  1. Open Storybook DataForm panel layout story with labelPosition: none http://localhost:50240/?path=/story/dataviews-dataform--layout-panel&args=labelPosition:none
  2. Clear the Title field "(Hello World)".
  3. Verify the placeholder appears and clicking it opens the panel

@jorgefilipecosta jorgefilipecosta 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 Dec 4, 2025
@github-actions
Copy link

github-actions bot commented Dec 4, 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: jorgefilipecosta <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: jameskoster <[email protected]>

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

@jorgefilipecosta
Copy link
Member Author

cc: @oandregal, @jameskoster

'aria-expanded'?: boolean;
} ) {
const isEmpty =
labelPosition === 'none' &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still familiarizing myself with DF, but I think:

  1. the same problem occurs even with a label
  2. the same problem occurs at least in card layout

When empty should we use for summaryContent an edit: ${attribute label} instead of empty field? I think that's better, but if we went for an empty field approach, it should be different based on the number of fields.

Finally with this change in the story ?path=/story/dataviews-dataform--layout-panel&args=labelPosition:none the discussion appears empty. Is this in indicator that we need a getValue there in general?

Copy link
Contributor

@jameskoster jameskoster Dec 5, 2025

Choose a reason for hiding this comment

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

edit: ${attribute label}

I had a similar thought 👍

Edit: I realised this is a bit related to #73036. "${attribute label} unset" could also be an option for when the label is hidden. When the label is visible we might not need to repeat it.

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.

4 participants