Repository navigation
Post summary: Show placeholders for an empty excerpt and a missing author - #85842
Conversation
🤖 PR meta 🤖🎉 PropsIf 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: -3.05 kB (-0.04%) Total Size: 8.58 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome 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. Page List converts to Navigation Links with entity bindings in
|
|
cc @verofasulo |
mirka
left a comment
There was a problem hiding this comment.
I also hit this issue in an audit, and the Author field also has this problem, where it used to show "(No author)" in 7.1. Now it's just blank.
In case there's room to rethink the design, I'll note that the interactivity affordance is still a bit weak on touch devices where there's no hover cue.
We should also check in force colors mode. Bold text is now a design system cue for interactivity, but normal-weight placeholder text wouldn't be sufficient.
6cadd21 to
5ca9b42
Compare
| typeof item.excerpt === 'string' ? item.excerpt : item.excerpt?.raw; | ||
| return excerpt ? ( | ||
| <Text className={ styles.excerpt }> | ||
| <span className={ styles.excerpt }> |
There was a problem hiding this comment.
Changing from Text to span so that the field has the same weight as any other field.
| &:not(:empty) + .dataforms-layouts-panel__field-placeholder { | ||
| display: none; | ||
| } | ||
| } |
There was a problem hiding this comment.
This is connected with the changes in summary-button.jsx so that we can display the placeholder when the field has tried fetching data but still returns nothing (e.g., author field that didn't found the author).
I tried alternatives such as moving the decision to the field render: this is unsatisfactory because we only want the placeholder when in the panel mode and only if the showPlaceholderIfEmpty form prop is enabled. The field must remain view/form agnostic.
An empty excerpt row showed only its label, with nothing telling users the row is editable until they hover it. Turn on the panel layout's `showPlaceholderIfEmpty` for the excerpt, so the row reads "Add an excerpt" (or "Add a description" for patterns). The field's `render` still returns nothing, so DataViews lists stay empty. The setting is a 7.2 layer that merges into the `excerpt` member of the post types whose form lists it: those using the default form, and patterns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The excerpt row's edit button only appeared on hover or focus, so in a still view nothing showed the row could be edited. Set the panel layout's `editVisibility` to `always` in the 7.2 layer for the excerpt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The placeholder that `showPlaceholderIfEmpty` shows had no styles, so it inherited the bold of the panel values and read as a value itself. Give it the default weight and the muted color of the labels, turning to the brand color on row hover like the label does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Layers `showPlaceholderIfEmpty` onto the `author` member of the default post type form, as for the excerpt. Post types providing their own form are skipped, since the patch would append the member there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In forced colors mode the muted color of the placeholder is replaced by the system text color, so a normal-weight placeholder looked like the label next to it, and the row no longer read as editable. Keep the emphasized weight of values, the design system cue for interactivity, and mute the placeholder by color only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Now that the placeholder shares the weight of values, the parentheses mark it as standing in for an empty excerpt, like "(No author)". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The excerpt rendered through `Text` of `@wordpress/ui`, which sets its own font weight, so in a panel row it was not emphasized like the values of other fields. Render it in a plain `span`, keeping the three-line clamp, so it takes the typography of where it renders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pattern and template descriptions now use "(No description)", like the "(No excerpt)" and "(No author)" placeholders, so all of them read as standing in for an empty value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pattern and template descriptions rendered through `Text` of `@wordpress/ui`, which sets its own font weight, so in a panel row they were not emphasized like the excerpt and the values of other fields. Render them in a plain `span`, so they take the typography of where they render. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mpty The description row of a template showed only its label when the description was empty, while the excerpt row of posts and patterns shows "(No excerpt)". Turn on `showPlaceholderIfEmpty` for it, so an empty description shows "(No description)". The row only appears for templates created by users, so theme and plugin templates are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…thor Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…as no author The attachment form lists the `author` field at its top level too, so the author layout patch merges into it like it does for the default form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
05ebe4b to
3cee79d
Compare
jorgefilipecosta
left a comment
There was a problem hiding this comment.
Things tested well on my wp-env and the code looks good 👍 I checked the post editor, the media editor, and patterns, and the placeholders show for an empty excerpt, an empty description, and a missing author, including media without an author. The unit, PHPUnit, and e2e tests also pass locally.
The failed e2e job broke during the environment setup before any test ran, so I think a re-run should make it green. I guess we should also add the author and description layouts to WordPress/wordpress-develop#15120 so the core backport matches this PR.
|
There was a conflict while trying to cherry-pick the commit to the wp/7.2 branch. Please resolve the conflict manually and create a PR to the wp/7.2 branch. PRs to wp/7.2 are similar to PRs to trunk, but you should base your PR on the wp/7.2 branch instead of trunk. |
|
Manual backport at #86294 |
…r fields. Turns on the panel layout's `showPlaceholderIfEmpty` option in `view-config.php` for the fields that render nothing when empty, so their row in the editor's summary panel shows the field's placeholder instead of only its label, which gave users no hint the row could be edited until they hovered it: - `excerpt`, in the default post type form and in the `wp_block` form. - `description`, in the `wp_template` form. - `author`, in the default post type form and in the `attachment` form, for a post or media item without a known author, as the post summary did before it moved to the form. DataViews lists are not affected, since the placeholder only shows in the panel summary. Backports the changes from WordPress/gutenberg#85842. Props oandregal, jorgefilipecosta, 0mirka00. Fixes #65981. git-svn-id: https://develop.svn.wordpress.org/trunk@65273 602fd350-edb4-49c9-b593-d223f7449a82
…r fields. Turns on the panel layout's `showPlaceholderIfEmpty` option in `view-config.php` for the fields that render nothing when empty, so their row in the editor's summary panel shows the field's placeholder instead of only its label, which gave users no hint the row could be edited until they hovered it: - `excerpt`, in the default post type form and in the `wp_block` form. - `description`, in the `wp_template` form. - `author`, in the default post type form and in the `attachment` form, for a post or media item without a known author, as the post summary did before it moved to the form. DataViews lists are not affected, since the placeholder only shows in the panel summary. Backports the changes from WordPress/gutenberg#85842. Props oandregal, jorgefilipecosta, 0mirka00. Fixes #65981. Built from https://develop.svn.wordpress.org/trunk@65273 git-svn-id: http://core.svn.wordpress.org/trunk@64422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates the pinned commit hash of the Gutenberg repository from `c035c1a649ef68f5c1646694cf440df1d7ae6e62` to `1b0dc90c700746b108e080263a4dc67707b750a1` (fixes cherry-picked to the `wp/7.2` branch). A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@c035c1a...1b0dc90 - [WP 7.2] Components, UI: Use focus-visible for disabled item focus rings (WordPress/gutenberg#86269) - Notes: Keep the canvas still when a new note is added (WordPress/gutenberg#86283) (#86293) - Post summary: Show placeholders for an empty excerpt and a missing author (WordPress/gutenberg#85842) (#86294) - Core fields: Restore the previous Publish and Status panel date behaviour (WordPress/gutenberg#86065) (#86295) - Interactivity API: Show the data-wp-html fallback on created elements under Trusted Types (WordPress/gutenberg#84924) (#86306) - [WP 7.2] UI: Add LoadingIndicator to item popups (WordPress/gutenberg#86303) - Interactivity Router: Fix nested router regions without data-wp-interactive disappearing on navigation (WordPress/gutenberg#86061) (#86308) - Interactivity API: Run watch() cleanups and attachTo render callbacks without a directive scope (WordPress/gutenberg#86058) (#86311) - DataForm: Fix clipped focus ring of field values in panel layout (WordPress/gutenberg#86361) (#86369) - Tests: Avoid passing an object when invoking static methods via reflection. (WordPress/gutenberg#86329) - [WP 7.2] DropdownMenu: Invert the selected item indicator while highlighted (WordPress/gutenberg#86379) - Fields: Lowercase the (no excerpt), (no author) and (no description) placeholders (WordPress/gutenberg#86391) (#86424) - Core fields: Decode non-Latin slugs in the slug field (WordPress/gutenberg#86359) - Interactivity API: Show the new page's server content in kept data-wp-html elements (WordPress/gutenberg#86416) - DataForm: Tighten value density in the panel layout (WordPress/gutenberg#86389) (#86426) - Post summary: Show "Immediately" and relative publish dates in the Date row (WordPress/gutenberg#86367) - [WP 7.2] Block Styles: Show the active style variation in forced colors mode (WordPress/gutenberg#86450) - Site Editor: Fix the frame snapping to the mobile width when resized with the mouse (WordPress/gutenberg#86423) - Image: measure the lightbox container, not the image's parent (WordPress/gutenberg#82312) (#85491) - URL: Decode percent-encoded characters in getFilename (WordPress/gutenberg#86422) (#86477) - Fix: Hide the author avatar when the site does not show avatars and frame a blank one. (WordPress/gutenberg#86395) - Date picker: Mark the posts of the month a typed or reset date moves to (WordPress/gutenberg#86298) (#86463) - Fix iOS 27 tap into a heading leaving the caret in a quote (WordPress/gutenberg#85809) - Hand focus back to the field on a press in every browser (WordPress/gutenberg#86549) - Prevent jobs from running within forks on `push`. (WordPress/gutenberg#85968) - i18n: Add translator context to the "Copy error" button label (WordPress/gutenberg#85967) - Bubble editor canvas events to the outer iframe (WordPress/gutenberg#85263) - UI: Use LoadingIndicator in remaining popup consumers (WordPress/gutenberg#86501) - Block Editor: Keep the revision canvas read-only in preview mode (WordPress/gutenberg#84578) - Core Data: Rank an exact title match first among tied link suggestions (WordPress/gutenberg#86327) - Tests: Render the router-html-server context case through state (WordPress/gutenberg#86511) - iOS tests: De-flake the selection handle test (WordPress/gutenberg#85461) Props mamaduka, wildworks. See #66340. git-svn-id: https://develop.svn.wordpress.org/trunk@65379 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned commit hash of the Gutenberg repository from `c035c1a649ef68f5c1646694cf440df1d7ae6e62` to `1b0dc90c700746b108e080263a4dc67707b750a1` (fixes cherry-picked to the `wp/7.2` branch). A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@c035c1a...1b0dc90 - [WP 7.2] Components, UI: Use focus-visible for disabled item focus rings (WordPress/gutenberg#86269) - Notes: Keep the canvas still when a new note is added (WordPress/gutenberg#86283) (#86293) - Post summary: Show placeholders for an empty excerpt and a missing author (WordPress/gutenberg#85842) (#86294) - Core fields: Restore the previous Publish and Status panel date behaviour (WordPress/gutenberg#86065) (#86295) - Interactivity API: Show the data-wp-html fallback on created elements under Trusted Types (WordPress/gutenberg#84924) (#86306) - [WP 7.2] UI: Add LoadingIndicator to item popups (WordPress/gutenberg#86303) - Interactivity Router: Fix nested router regions without data-wp-interactive disappearing on navigation (WordPress/gutenberg#86061) (#86308) - Interactivity API: Run watch() cleanups and attachTo render callbacks without a directive scope (WordPress/gutenberg#86058) (#86311) - DataForm: Fix clipped focus ring of field values in panel layout (WordPress/gutenberg#86361) (#86369) - Tests: Avoid passing an object when invoking static methods via reflection. (WordPress/gutenberg#86329) - [WP 7.2] DropdownMenu: Invert the selected item indicator while highlighted (WordPress/gutenberg#86379) - Fields: Lowercase the (no excerpt), (no author) and (no description) placeholders (WordPress/gutenberg#86391) (#86424) - Core fields: Decode non-Latin slugs in the slug field (WordPress/gutenberg#86359) - Interactivity API: Show the new page's server content in kept data-wp-html elements (WordPress/gutenberg#86416) - DataForm: Tighten value density in the panel layout (WordPress/gutenberg#86389) (#86426) - Post summary: Show "Immediately" and relative publish dates in the Date row (WordPress/gutenberg#86367) - [WP 7.2] Block Styles: Show the active style variation in forced colors mode (WordPress/gutenberg#86450) - Site Editor: Fix the frame snapping to the mobile width when resized with the mouse (WordPress/gutenberg#86423) - Image: measure the lightbox container, not the image's parent (WordPress/gutenberg#82312) (#85491) - URL: Decode percent-encoded characters in getFilename (WordPress/gutenberg#86422) (#86477) - Fix: Hide the author avatar when the site does not show avatars and frame a blank one. (WordPress/gutenberg#86395) - Date picker: Mark the posts of the month a typed or reset date moves to (WordPress/gutenberg#86298) (#86463) - Fix iOS 27 tap into a heading leaving the caret in a quote (WordPress/gutenberg#85809) - Hand focus back to the field on a press in every browser (WordPress/gutenberg#86549) - Prevent jobs from running within forks on `push`. (WordPress/gutenberg#85968) - i18n: Add translator context to the "Copy error" button label (WordPress/gutenberg#85967) - Bubble editor canvas events to the outer iframe (WordPress/gutenberg#85263) - UI: Use LoadingIndicator in remaining popup consumers (WordPress/gutenberg#86501) - Block Editor: Keep the revision canvas read-only in preview mode (WordPress/gutenberg#84578) - Core Data: Rank an exact title match first among tied link suggestions (WordPress/gutenberg#86327) - Tests: Render the router-html-server context case through state (WordPress/gutenberg#86511) - iOS tests: De-flake the selection handle test (WordPress/gutenberg#85461) Props mamaduka, wildworks. See #66340. Built from https://develop.svn.wordpress.org/trunk@65379 git-svn-id: http://core.svn.wordpress.org/trunk@64518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…r fields. Turns on the panel layout's `showPlaceholderIfEmpty` option in `view-config.php` for the fields that render nothing when empty, so their row in the editor's summary panel shows the field's placeholder instead of only its label, which gave users no hint the row could be edited until they hovered it: - `excerpt`, in the default post type form and in the `wp_block` form. - `description`, in the `wp_template` form. - `author`, in the default post type form and in the `attachment` form, for a post or media item without a known author, as the post summary did before it moved to the form. DataViews lists are not affected, since the placeholder only shows in the panel summary. Backports the changes from WordPress/gutenberg#85842. Props oandregal, jorgefilipecosta, 0mirka00. Fixes #65981. git-svn-id: https://develop.svn.wordpress.org/trunk@65273 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned commit hash of the Gutenberg repository from `c035c1a649ef68f5c1646694cf440df1d7ae6e62` to `1b0dc90c700746b108e080263a4dc67707b750a1` (fixes cherry-picked to the `wp/7.2` branch). A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@c035c1a...1b0dc90 - [WP 7.2] Components, UI: Use focus-visible for disabled item focus rings (WordPress/gutenberg#86269) - Notes: Keep the canvas still when a new note is added (WordPress/gutenberg#86283) (#86293) - Post summary: Show placeholders for an empty excerpt and a missing author (WordPress/gutenberg#85842) (#86294) - Core fields: Restore the previous Publish and Status panel date behaviour (WordPress/gutenberg#86065) (#86295) - Interactivity API: Show the data-wp-html fallback on created elements under Trusted Types (WordPress/gutenberg#84924) (#86306) - [WP 7.2] UI: Add LoadingIndicator to item popups (WordPress/gutenberg#86303) - Interactivity Router: Fix nested router regions without data-wp-interactive disappearing on navigation (WordPress/gutenberg#86061) (#86308) - Interactivity API: Run watch() cleanups and attachTo render callbacks without a directive scope (WordPress/gutenberg#86058) (#86311) - DataForm: Fix clipped focus ring of field values in panel layout (WordPress/gutenberg#86361) (#86369) - Tests: Avoid passing an object when invoking static methods via reflection. (WordPress/gutenberg#86329) - [WP 7.2] DropdownMenu: Invert the selected item indicator while highlighted (WordPress/gutenberg#86379) - Fields: Lowercase the (no excerpt), (no author) and (no description) placeholders (WordPress/gutenberg#86391) (#86424) - Core fields: Decode non-Latin slugs in the slug field (WordPress/gutenberg#86359) - Interactivity API: Show the new page's server content in kept data-wp-html elements (WordPress/gutenberg#86416) - DataForm: Tighten value density in the panel layout (WordPress/gutenberg#86389) (#86426) - Post summary: Show "Immediately" and relative publish dates in the Date row (WordPress/gutenberg#86367) - [WP 7.2] Block Styles: Show the active style variation in forced colors mode (WordPress/gutenberg#86450) - Site Editor: Fix the frame snapping to the mobile width when resized with the mouse (WordPress/gutenberg#86423) - Image: measure the lightbox container, not the image's parent (WordPress/gutenberg#82312) (#85491) - URL: Decode percent-encoded characters in getFilename (WordPress/gutenberg#86422) (#86477) - Fix: Hide the author avatar when the site does not show avatars and frame a blank one. (WordPress/gutenberg#86395) - Date picker: Mark the posts of the month a typed or reset date moves to (WordPress/gutenberg#86298) (#86463) - Fix iOS 27 tap into a heading leaving the caret in a quote (WordPress/gutenberg#85809) - Hand focus back to the field on a press in every browser (WordPress/gutenberg#86549) - Prevent jobs from running within forks on `push`. (WordPress/gutenberg#85968) - i18n: Add translator context to the "Copy error" button label (WordPress/gutenberg#85967) - Bubble editor canvas events to the outer iframe (WordPress/gutenberg#85263) - UI: Use LoadingIndicator in remaining popup consumers (WordPress/gutenberg#86501) - Block Editor: Keep the revision canvas read-only in preview mode (WordPress/gutenberg#84578) - Core Data: Rank an exact title match first among tied link suggestions (WordPress/gutenberg#86327) - Tests: Render the router-html-server context case through state (WordPress/gutenberg#86511) - iOS tests: De-flake the selection handle test (WordPress/gutenberg#85461) Props mamaduka, wildworks. See #66340. git-svn-id: https://develop.svn.wordpress.org/trunk@65379 602fd350-edb4-49c9-b593-d223f7449a82




What?
See #76076 (comment) (part of #76076)
Two rows of the post summary no longer render as a bare label when their value is empty:
0), or whose author id matches no user listed as an author (like a deleted user), shows "(No author)", as the post summary did before it moved to the form.When empty
When not empty
Why?
Since #82423, the excerpt field renders nothing when empty, which is right for DataViews lists, where fields aren't editable. In the panel row, though, that leaves only the "Excerpt" label, and the edit button only appears on hover or focus. The call-for-testing feedback linked above points out that in a still view, roughly what a keyboard or low-vision user sees before hovering, nothing tells you the row is editable.
The author row has the same problem, and it's a regression: the post summary showed "(No author)" for a post without an author before it moved to the form, and the author field now renders nothing for it.
Options considered for the excerpt
editVisibility: 'always')Committed in 3fac020 and reverted in 1b6fa7f, kept in the history in case we want to reuse it. I'm not convinced this is the way forward, but it's a possibility we have and wanted to share.
The placeholder is muted by color and turns to the brand color on row hover, like the label. It keeps the emphasized weight of values, which is what tells it apart from the label in forced colors mode, and the parentheses mark it as standing in for a value, like "(No author)".
regularlayoutExplored in #82444 (closed). Needs its own design exploration, see #76076 (comment).
Suggested in #82423 (comment). "Add an excerpt" is a call to action rather than an example value.
How?
packages/dataviews:showPlaceholderIfEmptyalso shows the placeholder when the field'srenderoutput is empty, not only its value. A value can render nothing, like an id matching no record, which the field may only learn after fetching it. The panel renders the value followed by the placeholder, and CSS shows the placeholder only while the value's wrapper is:empty.packages/core-fields:spaninstead ofTextof@wordpress/ui, so it takes the emphasized weight of other values in the panel.lib/compat/wordpress-7.2/view-config-api.php: 7.2 layers mergeshowPlaceholderIfEmpty: trueinto theexcerptandauthormembers of the form, by id, so the rest of their 7.1 layout stays as is. They're registered for every post type using the default form (including custom post types), and the excerpt one for patterns too. Post types with their own form that doesn't list the field are skipped, sincemerge()would append the member there.Testing Instructions
Excerpt
Author
npm run wp-env run cli -- wp post update <id> --post_author=9999.--post_author=0: the row shows the same placeholder.Testing Instructions for Keyboard
Use of AI Tools
Claude Code (Claude Opus 5.5) wrote the code, tests and this description; I reviewed them and chose between the options.