Opened 10 days ago
Closed 7 days ago
#64346 closed defect (bug) (invalid)
SVG Image dimensions overwritten to hardcoded 24 pixels
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 6.9 |
| Component: | Media | Keywords: | |
| Focuses: | Cc: |
Description (last modified by )
I have an SVG image in my <Button /> component from wordpress/components as an icon. Once the version updated to 9. The dimension of the svg image which is originally 160 X 50 changed to 24px in width and height. This was supposedly introduced by the changes here for #63714.
I have added the images in the comments on the commit too.
Attachments (3)
Change History (7)
#1
@
10 days ago
- Description modified (diff)
Hi and welcome to WordPress Core Trac!
I do not think that this would relate to ticket #63714. It edited the wp_get_attachment_image() function, and the ns.svg plugin resource is not an attachment.
This might be one of the cases of GB70756 changing the old output of the Icon component, but I would appreciate someone else checking that (because I do not know the wordpress/components package well).
#2
@
9 days ago
- Keywords close added
This is probably something that would be better reported to the Gutenberg repo, because that's where this package is maintained.
In any case, take a look at the docs for the Icon component: https://github.com/WordPress/gutenberg/tree/trunk/packages/components/src/icon
The size prop's default value is defined as:
Defaults to 20 when icon is a string (i.e. a Dashicon id), otherwise 24.
Since you're passing in a component, it makes sense that you'd be seeing a size of 24x24.
In other words, it does not read the size from the SVG. You'll need to supply the size yourself.
React Code where I am including the file