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 resize tool sets dimensions when it shouldn't #6191

Closed
jasmussen opened this issue Apr 16, 2018 · 0 comments · Fixed by #6205
Closed

Image resize tool sets dimensions when it shouldn't #6191

jasmussen opened this issue Apr 16, 2018 · 0 comments · Fixed by #6205
Labels
[Type] Bug An existing feature does not function as intended

Comments

@jasmussen
Copy link
Contributor

As discovered in #5812 (comment) and possibly a regression since #5973, it appears the library we use to add resize handles to the image blocks needs a little love.

The issue is that the inline styles that a resized image receives here: https://github.com/WordPress/gutenberg/blob/master/blocks/library/image/block.js#L253 — they get applied when they shouldn't be. That means if you resize the viewport, the image doesn't resize with it, as the dimensions are explicitly set as inline styles.

Steps to reproduce:

  1. Set the editor canvas to show at a >782px breakpoint (this is where the navigation bar on the left shows up)
  2. Insert an image that's larger than the editor canvas.
  3. Resize the viewport and note that the image doesn't size with it, as it should

That's the buggy part.

It works, if your editor canvas is <782 breakpoint. I.e. if you repeat the steps above at the breakpoint where the left sidebar is hidden, then no inline styles are set, and the image behaves as it should.

Screenshots:

screen shot 2018-04-16 at 09 44 03

☝️That's at <782px, note no inline styles.

screen shot 2018-04-16 at 09 44 25

☝️That's at >782px, note the inline style.

GIF:

inlinestyles

CC: @youknowriad — I think you worked on image resizing, any idea what this might be a regression from, or how to best fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant