Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/dataviews/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Bug Fixes

- DataViews: Fix link styling in table layout when the title field itself is a link element. [#73489](https://github.com/WordPress/gutenberg/pull/73489)

## 14.2.0 (2026-04-29)

### Enhancements
Expand Down
9 changes: 7 additions & 2 deletions packages/dataviews/src/dataviews/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@
white-space: nowrap;
width: 100%;

a {
text-decoration: none;
a,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we do without a styles entirely, and instead expect to use Link everywhere?

No having any default a styles should also make it quite obvious when a Link is not used.

&:is(a) {
text-decoration: underline;
text-decoration-thickness: 0.5px;
text-decoration-color: $gray-600;
text-underline-offset: 0.2em;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
Expand All @@ -98,6 +102,7 @@

&:hover {
color: var(--wp-admin-theme-color);
text-decoration-color: var(--wp-admin-theme-color);
}
@include link-reset();
}
Expand Down
15 changes: 15 additions & 0 deletions packages/edit-site/src/components/page-patterns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
import { privateApis as routerPrivateApis } from '@wordpress/router';
import { useView, useViewConfig } from '@wordpress/views';
import { useSelect } from '@wordpress/data';
// eslint-disable-next-line @wordpress/use-recommended-components
import { Link } from '@wordpress/ui';
import { addQueryArgs } from '@wordpress/url';

/**
Expand Down Expand Up @@ -213,6 +215,19 @@ export default function DataviewsPatterns() {
}?canvas=edit`
);
} }
renderItemLink={ ( { item, ...props } ) => (
<Link
href={ `/${ item.type }/${
[
PATTERN_TYPES.user,
TEMPLATE_PART_POST_TYPE,
].includes( item.type )
? item.id
: item.name
}?canvas=edit` }
{ ...props }
/>
) }
view={ view }
onChangeView={ updateView }
defaultLayouts={ defaultLayouts }
Expand Down
12 changes: 12 additions & 0 deletions packages/edit-site/src/components/page-templates/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
import { addQueryArgs } from '@wordpress/url';
import { useSelect, useDispatch } from '@wordpress/data';
import { useEvent } from '@wordpress/compose';
// eslint-disable-next-line @wordpress/use-recommended-components
import { Link } from '@wordpress/ui';
import { useView } from '@wordpress/views';
import { Modal } from '@wordpress/components';
import { store as noticesStore } from '@wordpress/notices';
Expand Down Expand Up @@ -348,6 +350,16 @@ export default function PageTemplates() {
);
}
} }
renderItemLink={ ( { item, ...props } ) =>
typeof item.id !== 'string' ? (
<Link
href={ `/${ item.type }/${ item.id }?canvas=edit` }
{ ...props }
/>
) : (
<div { ...props } />
)
}
selection={ selection }
defaultLayouts={ defaultLayouts }
onReset={
Expand Down
8 changes: 8 additions & 0 deletions packages/edit-site/src/components/post-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { useSelect } from '@wordpress/data';
import { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';
import { privateApis as editorPrivateApis } from '@wordpress/editor';
import { useEvent, usePrevious } from '@wordpress/compose';
// eslint-disable-next-line @wordpress/use-recommended-components
import { Link } from '@wordpress/ui';
import { addQueryArgs } from '@wordpress/url';
import { useView, useViewConfig } from '@wordpress/views';

Expand Down Expand Up @@ -321,6 +323,12 @@ export default function PostList( { postType } ) {
onClickItem={ ( { id } ) => {
history.navigate( `/${ postType }/${ id }?canvas=edit` );
} }
renderItemLink={ ( { item, ...props } ) => (
<Link
href={ `/${ postType }/${ item.id }?canvas=edit` }
{ ...props }
/>
) }
getItemId={ getItemId }
getItemLevel={ getItemLevel }
defaultLayouts={ defaultLayouts }
Expand Down
Loading