moz-button icon should be stable when adding or removing a label
Categories
(Toolkit :: UI Widgets, defect, P3)
Tracking
()
People
(Reporter: mstriemer, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [recomp])
Attachments
(1 obsolete file)
Now that the icon variant of moz-button can have a label, it would be good for the icon to always be positioned with the same padding in both the labelled and unlabelled versions.
Currently the unlabelled version is 32x32 with the icon centred, this looks great! The labelled version has the icon positioned as if it were text, this also looks great! However, when an icon has text added to it, due to some responsive change most likely such as expanding its container so the text now fits, then the positioning changes, this does not look great as the icon will shift a few pixels :(
This was handled in a few places in a recent sidebar change and specifically for a moz-button
The general idea would be to position the unlabelled icon in the centre of the button using padding, rather than relying on flexbox. This means when we add a label we can keep the same padding and the icon won't shift.
.button-background[type~=icon],
.button-background:has(img) {
/* Use this regardless of if we are labelled or not so the icon doesn't shift */
padding-inline: calc((var(--button-size-icon) - var(--icon-size-default)) / 2 - var(--border-width));
}
Updated•5 months ago
|
Reporter | ||
Updated•5 months ago
|
Updated•3 months ago
|
Comment 1•2 months ago
|
||
- Move alignment fix from custom sidebar implementation into moz-button
Updated•2 months ago
|
Comment 2•2 months ago
|
||
Hey Mark! After team discussion, it appears this causes some visual changes to the buttons that are not desired at the moment. The patch also raised some concerns about performance. So unassigning myself for now until we decide on a path forward.
Updated•2 months ago
|
Description
•