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

Enhance Featured Image Block: Don't include interactive elements within a element #69730

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

Mayank-Tripathi32
Copy link
Contributor

@Mayank-Tripathi32 Mayank-Tripathi32 commented Mar 27, 2025

Attempts fix for #69728

What?

This PR updates the behavior of the Featured Image block inspector to conditionally display link-related controls based on whether the block is inside a Query Loop or not.

Why?

  • Prevents unnecessary link-related controls from appearing when they are not applicable.
  • Ensures that link controls are only available when they can be safely used without causing accessibility or usability issues.
  • Improves the overall user experience by keeping the block settings relevant to the context.

How?

  • If not inside a Query Loop and the featured image is not set, the link-related controls will not be rendered in the inspector.
  • If inside a Query Loop, the link-related controls will always be rendered, as they do not introduce any interactive buttons within an tag, ensuring safe usage.
  • It also introduces reset functionality to featured image and if its removed then it resets the attributes for link control.

ScreenCast

https://q7utzrengv.ufs.sh/f/Wgl9eBAmTj29CAEDuMerV9jUpFsYux6DJmaP53zkqdRfyBQC

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Block] Post Featured Image Affects the Post Featured Image Block labels Mar 28, 2025
@Mayank-Tripathi32
Copy link
Contributor Author

Failing tests seems irrelevant to PR.

@Mayank-Tripathi32 Mayank-Tripathi32 marked this pull request as ready for review March 31, 2025 14:44
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Mayank-Tripathi32 <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mayank-Tripathi32
Copy link
Contributor Author

@t-hamano Ready for review, failing tests seems irrelevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Featured Image Affects the Post Featured Image Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants