Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Linked featured image block cannot be selected correctly #68775

Merged
merged 1 commit into from
Jan 21, 2025
Merged
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
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
Loading