Repository navigation
Conversation
When `renderItemLink` is used, the title field wrapper is itself the link, so the `.dataviews-title-field a` reset does not apply and the title (and any badge in it) inherits the default link underline. Co-authored-by: t-hamano <54422211+t-hamano@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011g9URxCUqpueo5FHpbLJAC
Co-authored-by: t-hamano <54422211+t-hamano@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011g9URxCUqpueo5FHpbLJAC
🤖 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: +80 B (0%) Total Size: 8.68 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. Allows widget deletion to be undone in Navigates the list via UP/DOWN arrow keys from action buttons in
|
Co-authored-by: t-hamano <54422211+t-hamano@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011g9URxCUqpueo5FHpbLJAC
|
I remember some back and forths design wise for this one. @WordPress/gutenberg-design can you chime in? |
|
I'm not convinced this is a design question. For me the design should follow the semantics. In other words, if the items are links then we should indicate that to the user somehow (typically with an underline). That way they can predict link behaviors (e.g. right-click open-in-new-tab) rather than having to guess. So the question is really; should the titles be links or buttons? One thing I would say; the badge should probably be outside of the title element, or at least not inherit the underline. |
The title of an item that renders as a link keeps its underline, so users can tell it is a link. The page title badge, which inherited the underline from the link, now renders as an inline block inside a wrapper, which stops the underline from reaching it. Co-authored-by: t-hamano <54422211+t-hamano@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011g9URyKcjmHwMrNzohTbkh
|
Thanks for the feedback.
While looking for previous discussions on this, I found #73489. There seems to be agreement there that link titles should be underlined. So I've changed the direction of this PR: the title keeps its underline, and only the badge no longer inherits it. Note that the underline only appears when |
|
Could it make sense to add |
Good idea! I've concluded that this issue should be fixed in the Badge component. Closing this in favor of #87074 |
Note
Following the discussion in #73489 and #86937 (comment), this PR now keeps the title underline and removes it from the badge only. Outdated parts of the description are struck through.
What?
Removes the link underline from the title field in the DataViews table and grid layouts when items are rendered as links viarenderItemLink.Removes the link underline from the badge next to a page title, such as "Privacy Policy Page", in the DataViews table and grid layouts when items render as links with
renderItemLink. The title itself keeps its underline.Why?
In site editor v2, the page list shows the title, and badges such as "Privacy Policy Page", underlined. The v1 site editor does not, because it usesonClickItem, which renders adiv role="button"instead of a link..dataviews-title-field aresets the link styles, but in the table and grid layouts theItemClickWrapperelement with thedataviews-title-fieldclass is itself thea, so the selector never matches and the defaulta { text-decoration: underline }applies. The underline also propagates to the badge since #82499 replaced the ComponentsBadge, whoseinline-block/inline-flexwrapper blocked it, with the@wordpress/uiBadge.In Site Editor v2, the page list renders titles as links, so the title is underlined. The badge inside the title inherits that underline, which makes it look like part of the link text.
The title underline stays, following the discussion in #73489: titles that are links should be underlined so users can tell they are links. The v1 site editor uses
onClickItem, which renders a button rather than a link, so it has no underline in the first place. Whether both should consistently use links is a separate discussion.The underline reaches the badge since #82499 replaced the Components
Badge, whoseinline-flexwrapper blocked it, with the@wordpress/uiBadge.How?
Addstext-decoration: noneto.dataviews-title-field--clickable, the classItemClickWrapperadds to the clickable wrapper. This removes the underline at its source, so the badge needs no change.An element cannot remove an underline it inherits from an ancestor with
text-decoration: none, but an underline does not propagate into an inline block. The badge is a flex item of the title, and flex items are always blockified, so the badge is wrapped in aspanand rendered as an inline block inside it. The badge still truncates with an ellipsis when space runs out.Testing Instructions
Confirm the titles and the "Privacy Policy Page" badge have no underline, and the title color changes on hover.Confirm the titles are underlined and the "Privacy Policy Page" badge is not.Screenshots or screencast
Use of AI Tools
This PR was authored with Claude Code (Claude Opus 5.5), including the investigation, the fix and the screenshots, and reviewed by the author.