-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 block: Fix focus style not around whole image when linked #62556
Conversation
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +98 B (+0.01%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
Hi @t-hamano, can you please review this PR? Thanks |
@amitraj2203 This seems to work for most use cases, but in testing I'm seeing an issue with image blocks that are aligned full no longer having the right alignment (tested in Firefox): |
@talldan I have fixed it. Can you please verify it again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the ping!
I tested this PR and the focus outline looks incorrect in the Image block when the image size is less than the content.
How about going back to display: inline-block
and applying 100% width only for wide and full width?
diff --git a/packages/block-library/src/image/style.scss b/packages/block-library/src/image/style.scss
index 913cf48b90..fadb52e594 100644
--- a/packages/block-library/src/image/style.scss
+++ b/packages/block-library/src/image/style.scss
@@ -1,7 +1,7 @@
.wp-block-image {
- > a {
- display: block;
+ a {
+ display: inline-block;
}
img {
@@ -32,6 +32,11 @@
text-align: center;
}
+ &.alignfull a,
+ &.alignwide a {
+ width: 100%;
+ }
+
&.alignfull img,
&.alignwide img {
height: auto;
@t-hamano Thanks for reviewing PR. I have addressed the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
I tried various variations and found that they only solved the focus issue and didn't introduce any new layout or size issues.
This may seem like a small thing, but the &__
style isn't used much in the Gutenberg project.
We might want to change the syntax as follows:
diff --git a/packages/block-library/src/media-text/style.scss b/packages/block-library/src/media-text/style.scss
index 2828ea507f..de020611b3 100644
--- a/packages/block-library/src/media-text/style.scss
+++ b/packages/block-library/src/media-text/style.scss
@@ -12,10 +12,6 @@
&.has-media-on-the-right {
grid-template-columns: 1fr 50%;
}
-
- &__media > a {
- display: inline-block;
- }
}
.wp-block-media-text.is-vertically-aligned-top {
@@ -72,6 +68,10 @@
/*!rtl:end:ignore*/
}
+.wp-block-media-text__media a {
+ display: inline-block;
+}
+
.wp-block-media-text__media img,
.wp-block-media-text__media video {
height: auto;
@t-hamano Thanks for the review. Updated it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What?
Fixes: #62544
Why?
When the image block is linked the focus style for the link does not stretch around the whole image.
How?
Adds display property to
Image
block andMedia & Text
block.Testing Instructions
Screenshots or screencast
Screen.Recording.2024-06-13.at.10.19.58.PM.mov