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

Bug: Image block selecting medium or thumbnail does not relocate caption - caption centered in relation to boundry box. #17162

Closed
paaljoachim opened this issue Aug 23, 2019 · 18 comments · Fixed by #35787
Labels
[Block] Image Affects the Image Block [Type] Bug An existing feature does not function as intended

Comments

@paaljoachim
Copy link
Contributor

Describe the bug
Resizing image by selecting image size drop down does not relocate caption when selecting thumbnail or medium.

Screen Shot 2019-08-23 at 12 19 31

Btw I also tested the 25%, 50% etc and these worked nicely. Except when it resets back to medium or thumbnail default image size.

To reproduce
Steps to reproduce the behavior:

  1. Select an image block.
  2. Add image.
  3. Select thumbnail or medium image size in the drop down.
  4. Notice that the caption does not show directly under the image.

Expected behavior
That the caption would show directly under the image also on thumbnail and medium size image.

Chrome.
Using Desktop Server.
Mac OS 10.13.6

@phpbits
Copy link
Contributor

phpbits commented Sep 25, 2019

@paaljoachim Just checked and it seems to be theme-specific. For instance, if you are using TwentyTwenty theme with the default caption aligned to the left, you won't have this issue. Perhaps the solution is to define caption alignment on theme_support?

I'm not really sure what's the best solution but I'm working on Caption Alignment for EditorsKit - https://wordpress.org/plugins/block-options/ and I'm sure it'll help for user-specific solution. Here's what I have for alignment toolbar so far :

Screen Capture on 2019-09-25 at 17-24-07

@paaljoachim
Copy link
Contributor Author

That is good to hear Jeffrey! That means we can close this issue. Do you agree?

I tested using Twenty Nineteen and that has the error still there. I believe this is something @kjellr will need to adjust later on.

@tellthemachines
Copy link
Contributor

I can reproduce this issue on any small image, without resizing. It would be good to fix this issue in the editor rather than forcing themes to adopt specific styling as a workaround. Some context here which should be taken into account.

@paaljoachim
Copy link
Contributor Author

paaljoachim commented Nov 27, 2020

@tellthemachines As this is also affecting the new default theme Twenty Twenty One.
A fix should be backported to WP 5.6.

This is what it looks like:
100251818-79552380-2f3f-11eb-9b35-257096605081

The caption is aligned to the bounding/border box surrounding the image. It needs to be aligned directly to the image.
Screen Shot 2020-11-27 at 09 33 20

@tellthemachines
Copy link
Contributor

@paaljoachim unfortunately this is not a 5.6 regression, so it doesn't qualify for inclusion during RC stage. Agree we should fix it soon and make sure it's ready for 5.7.

@paaljoachim
Copy link
Contributor Author

Hi Isabel @tellthemachines
What can perhaps be done it getting a fix for this into a 5.6.1 release.

@paaljoachim
Copy link
Contributor Author

@noisysocks Robert.
This is an important user interface adjustment that we should get either into 5.6.1 or 5.7 "Must haves".
Thanks.

I look forward to being able to center captions below the image. Today too many captions are off centered.

@noisysocks
Copy link
Member

Thanks for flagging.

@noisysocks noisysocks added the [Type] Bug An existing feature does not function as intended label Jan 11, 2021
@paaljoachim paaljoachim changed the title Bug: Image block selecting medium or thumbnail does not relocate caption Bug: Image block selecting medium or thumbnail does not relocate caption - caption centered in relation to boundry box. Jan 20, 2021
@paaljoachim
Copy link
Contributor Author

Related issues:
Missing text-align for image caption
#19975

Introduce explicit caption positioning
#12997
Inline alignment caption toolbar. Which would give the user the option into where the caption should be placed.

Image caption styles global styles support
#27480

@talldan
Copy link
Contributor

talldan commented Jan 29, 2021

This issue seems like a duplicate of #11719

@paaljoachim
Copy link
Contributor Author

paaljoachim commented Jan 29, 2021

Hey Dan @talldan
This issue is a duplicate of #11719 . I closed the other issue so that we can focus on this issue which has been added the 5.7 project board.

Bottom line is that is looks like we need to rework the Image block, as multiple issues needs to be addressed.
Here is another issue: #21836

@mtias
Copy link
Member

mtias commented Feb 9, 2021

@paaljoachim these issues don't require reworking the image block!

@paaljoachim
Copy link
Contributor Author

paaljoachim commented Feb 16, 2021

Can we keep the image centered within the boundary box, so that the caption is always centered below the image?
@tellthemachines @jasmussen

@paaljoachim
Copy link
Contributor Author

paaljoachim commented Oct 8, 2021

It would be nice to get this fix into WP 5.9.
I am hoping someone is able to take a closer look.
Thanks!

We are getting additional reports on this.

Additional associated/duplicate issues:
Image alignment is left by default but it displays center as default
#33349

Images are centered in editor and aligned left in preview
#31011

I made a quick fix through the CSS to one of my customer sites. Which shows the caption centered below the image independent of the size on the frontend. Backend still shows the caption centered to the boundry box.

wp-block-image {
margin-bottom: 1.2em;
display: inline-block;
justify-content: center;
}

Screenshot 2021-10-08 at 09 41 29

@Mamaduka

This seems like one solution. (PR has stalled)
Image block: try caption as inner block
#31823

@paaljoachim
Copy link
Contributor Author

paaljoachim commented Oct 8, 2021

There seems bigger fixes needed related to the PR which was suggested by @jasmussen
#31823 (comment)

Can we create a step between? With focus on improving the current caption alignment problem. A fix that can also later be incorporated into the PR by @ellatrix

@antpb
Copy link
Contributor

antpb commented Oct 14, 2021

Is it possible the solution for this could be making the caption respect the alignment of the image? For instance, the image currently initializes left aligned. The caption initializes centered. Is there a reason they aren't the same alignment? It would greatly improve the experience if I added an image block with everything matching the default alignment.

More often than not when I add an image block, the first thing I do is click center so it matches the alignment of the caption. That seems to be the core problem. Folks want to unify that button with the content of the image block which currently has alignment settings.

@glendaviesnz
Copy link
Contributor

Potential fix for this at #35787

@paaljoachim
Copy link
Contributor Author

A big thank you to @glendaviesnz and @andrewserong !

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
9 participants