Skip to content

Commit

Permalink
Fix: Linked featured image block cannot be selected correctly (#68775)
Browse files Browse the repository at this point in the history
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
  • Loading branch information
3 people authored Jan 21, 2025
1 parent 39ed61d commit e68767f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
17 changes: 2 additions & 15 deletions packages/block-library/src/post-featured-image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ function getMediaSourceUrlBySizeSlug( media, slug ) {
);
}

const disabledClickProps = {
onClick: ( event ) => event.preventDefault(),
'aria-disabled': true,
};

export default function PostFeaturedImageEdit( {
clientId,
attributes,
Expand Down Expand Up @@ -318,11 +313,7 @@ export default function PostFeaturedImageEdit( {
{ controls }
<div { ...blockProps }>
{ !! isLink ? (
<a
href={ postPermalink }
target={ linkTarget }
{ ...disabledClickProps }
>
<a href={ postPermalink } target={ linkTarget }>
{ placeholder() }
</a>
) : (
Expand Down Expand Up @@ -430,11 +421,7 @@ export default function PostFeaturedImageEdit( {
<figure { ...blockProps }>
{ /* If the featured image is linked, wrap in an <a /> tag to trigger any inherited link element styles */ }
{ !! isLink ? (
<a
href={ postPermalink }
target={ linkTarget }
{ ...disabledClickProps }
>
<a href={ postPermalink } target={ linkTarget }>
{ image }
</a>
) : (
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/post-featured-image/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@

// When the Post Featured Image block is linked,
// it's wrapped with a disabled <a /> tag.
// Restore cursor style so it doesn't appear 'clickable'.
// Ensure that the link is not clickable.
> a {
cursor: default;
pointer-events: none;
}

// When the Post Featured Image block is linked,
Expand Down

1 comment on commit e68767f

@github-actions
Copy link

Choose a reason for hiding this comment

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

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

Please sign in to comment.