-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix icon size regression #10938
Fix icon size regression #10938
Conversation
This PR fixes an icon size regression that was introduced in #9828. Basically SVG icons are _between 20 and 24px_. If an SVG has an explicit width, it uses that width, within the boundaries of those extremes. But unfortunately it also means if the SVG _doesn't_ have an explicit width or height, it collapses to the min-width and min-height. This PR updates documentation, and adds explicit dimensions for all block icons used.
@jasmussen I think this is actually another issue. In the BlockIcon component, we should be enforcing I'm inclined to think this is related to all the React Native-related SVG refactoring… cc @gziolo That said I think it's good for this to land either way — better to be explicit about width/height if possible because it encourages users to do the same! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving for the explicitness of providing width/height (I think it's good for us to be explicit) but we should still look into why the default width/height attributes aren't being applied inside <BlockIcon />
.
I really like the sound of that, and I'd like to do that in this branch. Let me see if I can. |
Boy that's a gnarly rebase. Something big just changed with embeds that moved it all elsewhere. I might do a complete re-do of this one. Apologies if that requires an extra ping. |
Interesting, from a casual dive into the BlockIcon component, it looks like it should, as Chris suggests, output explicit widths and heights on each icon, according to https://github.com/WordPress/gutenberg/blob/master/packages/editor/src/components/block-icon/index.js#L25. @gziolo you are stronger than me in code, can you figure out why those attributes aren't properly output? |
@jasmussen Sorry yes that was slightly confusingly worded — I meant that it should already be enforcing that 24 default 😄 There was a lot of work done around the move to the React Native-friendly version of the SVG component so my guess is that it's connected to that work. Also instead of a rebase you could probably just do |
This is an alternative to #10938 which for whatever reason I can't rebase. The purpose is the same: This PR fixes an icon size regression that was introduced in #9828. Basically SVG icons are _between 20 and 24px_. If an SVG has an explicit width, it uses that width, within the boundaries of those extremes. But unfortunately it also means if the SVG _doesn't_ have an explicit width or height, it collapses to the min-width and min-height. This PR updates documentation, and adds explicit dimensions for all block icons used. Before:  After: 
Closing this in favor of #10987. |
* Fix icon size regression. This is an alternative to #10938 which for whatever reason I can't rebase. The purpose is the same: This PR fixes an icon size regression that was introduced in #9828. Basically SVG icons are _between 20 and 24px_. If an SVG has an explicit width, it uses that width, within the boundaries of those extremes. But unfortunately it also means if the SVG _doesn't_ have an explicit width or height, it collapses to the min-width and min-height. This PR updates documentation, and adds explicit dimensions for all block icons used. Before:  After:  * Pretty up the code a bit.
* Fix icon size regression. This is an alternative to WordPress#10938 which for whatever reason I can't rebase. The purpose is the same: This PR fixes an icon size regression that was introduced in WordPress#9828. Basically SVG icons are _between 20 and 24px_. If an SVG has an explicit width, it uses that width, within the boundaries of those extremes. But unfortunately it also means if the SVG _doesn't_ have an explicit width or height, it collapses to the min-width and min-height. This PR updates documentation, and adds explicit dimensions for all block icons used. Before:  After:  * Pretty up the code a bit.
This PR fixes an icon size regression that was introduced in #9828. Basically SVG icons are between 20 and 24px.
If an SVG has an explicit width, it uses that width, within the boundaries of those extremes. But unfortunately it also means if the SVG doesn't have an explicit width or height, it collapses to the min-width and min-height.
This PR updates documentation, and adds explicit dimensions for all block icons used.
Before:
After: