WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.5k stars 4.2k forks source link

FocalPointPicker: SVG images without a width attribute are not displayed #43869

Open lichtmetzger opened 2 years ago

lichtmetzger commented 2 years ago

Description

If I use a SVG image with the FocalPointPicker component, it will be set to a width of 0 if no width is specified in the SVG itself.

I fixed this by overriding the generated CSS like this:

.components-focal-point-picker__media--image {
    width: 100%;
}

Step-by-step reproduction instructions

  1. Create a block with a MediaUpload control and set the media url as the (full width) background of the block.
  2. Insert a FocalPointPicker control into the block
  3. Upload a SVG image without any width attribute (like the attached one, for example)
  4. Try to use the Focal Point Picker, it will not be displayed correctly.

Screenshots, screen recording, code snippet

image test

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

artemiomorales commented 2 years ago

Confirmed in Wordpress 6.0.2.