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

Declare image alignment on its parent #23974

Open
robsonsobral opened this issue Jul 15, 2020 · 2 comments
Open

Declare image alignment on its parent #23974

robsonsobral opened this issue Jul 15, 2020 · 2 comments
Labels
[Block] Image Affects the Image Block [Type] Enhancement A suggestion for improvement.

Comments

@robsonsobral
Copy link

Is your feature request related to a problem? Please describe.

Currently, the images are wrapped by .wp-block-image, no matter their alignment. No other class is added, making impossible to stylize following elements based on image alignment.

Describe the solution you'd like

Is it possible to add a class to the wrapping div? Something like .wp-block-image--left-aligned-child and wp-block-image--right-aligned-child.

.wp-block-image--left-aligned-child ~ * {
  clear: right;
}

.wp-block-image--right-aligned-child  ~ * {
  clear: left;
}

Describe alternatives you've considered

I've no idea for other solution.

Thank you so much!

@talldan talldan added [Block] Image Affects the Image Block [Status] Needs More Info Follow-up required in order to be actionable. labels Jul 16, 2020
@talldan
Copy link
Contributor

talldan commented Jul 16, 2020

@robsonsobral I think this issue will need some more information to be able to progress.

Here's the HTML markup I see when aligning an image block in Gutenberg v8.5.

editor:
Screenshot 2020-07-16 at 10 34 43 am

post:
Screenshot 2020-07-16 at 10 35 30 am

This seems different to what you mentioned above when you mention a wrapping div with the class .wp-block-image. Checking an older version, it seems like this has changed, so it might be worth testing against more recent versions of the plugin.

Related to your issue I'd also recommend taking a look at #20650, which talks about some of the issue with alignments and potential solutions.

@robsonsobral
Copy link
Author

Thank you, @talldan ! I gonna look at that issue!

Running Gutenberg 8.5.1:

image

<div class="wp-block-image">
  <figure class="alignleft size-large">
    <img src="/wp-content/uploads/2020/07/transparencia-1.jpg"
      alt=""
      class="wp-image-37759"
      srcset="/wp-content/uploads/2020/07/transparencia-1.jpg 566w,
        /wp-content/uploads/2020/07/transparencia-1-337x337.jpg 337w,
        /wp-content/uploads/2020/07/transparencia-1-163x163.jpg 163w,
        /wp-content/uploads/2020/07/transparencia-1-200x200.jpg 200w"
        sizes="(max-width: 566px) 100vw, 566px">
  </figure>
</div>

Is there a command I can run on console, to check the running version?

@talldan talldan added [Type] Enhancement A suggestion for improvement. and removed [Status] Needs More Info Follow-up required in order to be actionable. labels Dec 16, 2020
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] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants