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

Remove inline-block display from image anchor in style.scss #67368

Merged
merged 2 commits into from
Dec 2, 2024

Conversation

yogeshbhutkar
Copy link
Contributor

@yogeshbhutkar yogeshbhutkar commented Nov 28, 2024

Fixes: #67366

What?

This PR removes the display: inline-block property from the image anchor that causes the caption anchors to not flow in continuation as described in the PR.

How?

The CSS rule causing the side-effect was removed.

Screenshots

Before:
Screenshot 2024-11-28 at 12 37 31 PM

After:
Screenshot 2024-11-28 at 12 38 50 PM

Screencast:

Screen.Recording.2024-11-28.at.12.32.16.PM.mov

@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review November 28, 2024 07:03
Copy link

github-actions bot commented Nov 28, 2024

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: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org>
Co-authored-by: hanneslsm <hanneslsm@git.wordpress.org>
Co-authored-by: frkly <frkly@git.wordpress.org>

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

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Block] Image Affects the Image Block labels Nov 29, 2024
@t-hamano
Copy link
Contributor

Thanks for the PR!

When deleting code, it's a good idea to use something like Git blame to find out why it's there. This code is to fix the unintended focus outline that occurs when images are linked, so we can't delete this code entirely (See #62556):

image

More importantly, the HTML changes when we add left/right alignment to images in the classic theme.

No left/right alignment:

<figure class="wp-block-image">
  <a href="">
    <img>
  </a>
</figure>

With left:right alignment:

<div class="wp-block-image">
  <figure class="alignleft">
    <a href="">
      <img>
    </a>
  </figure>
</div>

With these things in mind, I think the following selector would be good to accurately target links to the image itself:

.wp-block-image {
	> a,
	> figure > a {
		display: inline-block;
	}
}

@t-hamano
Copy link
Contributor

P.S. This issue also occurs when the images are wide and full width, but those issues will be fixed in #67392.

@yogeshbhutkar
Copy link
Contributor Author

Thank you, @t-hamano, for reviewing the PR. I have addressed your feedback and made the necessary updates. The code has been tested and is functioning as expected. It is now ready for your review.

Screenshot 2024-12-02 at 2 00 17 PM

@t-hamano t-hamano self-requested a review December 2, 2024 09:04
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@t-hamano t-hamano merged commit 2f670d5 into WordPress:trunk Dec 2, 2024
63 checks passed
@github-actions github-actions bot added this to the Gutenberg 19.9 milestone Dec 2, 2024
im3dabasia pushed a commit to im3dabasia/gutenberg that referenced this pull request Dec 4, 2024
…s#67368)

* Remove inline-block display from image anchor in style.scss

* Refactor: Set image anchor display to inline-block in style.scss

Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org>
Co-authored-by: hanneslsm <hanneslsm@git.wordpress.org>
Co-authored-by: frkly <frkly@git.wordpress.org>
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.

Unnecessary line breaks within image captions due to display: inline-block; on .wp-block-image a
2 participants