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

Image: Fix caption link wrapping in wide/full alignment #67220

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

himanshupathak95
Copy link
Contributor

@himanshupathak95 himanshupathak95 commented Nov 22, 2024

Fixes: #67206

What?

Changes the width CSS property of links within wide and full-width image block captions to prevent caption text from splitting across lines.

Why?

Currently, when a caption in a wide or full-width Image Block contains a link, the linked text appears on a separate line from the rest of the caption text. This creates an undesirable visual break in what should be continuous caption text.

This occurs due to the width: 100% CSS property being applied to links within wide/full-width image blocks, forcing them to take up the full width and create a line break.

Testing Instructions

  1. Open the block editor with a block theme (e.g., Twenty Twenty-Five)
  2. Insert an Image Block and add an image
  3. Add a caption like "Photo Credit: Nature is Amazing Photo Collection"
  4. Select "Nature is Amazing Photo Collection" and add a link
  5. Test with Wide Width alignment: Caption should now appear on one line

Screenshots

9
10

Modifies the width property for links within wide and full-width image blocks
from 100% to auto to prevent unintended line breaks in captions.
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: himanshupathak95 <[email protected]>
Co-authored-by: Infinite-Null <[email protected]>
Co-authored-by: jartes <[email protected]>

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

@akasunil akasunil added [Type] Bug An existing feature does not function as intended [Block] Image Affects the Image Block labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the 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.

Image Block: Caption with Link in Wide-Width and Full-Width Images Appears on Two Lines Instead of One Line
2 participants