design-system icon indicating copy to clipboard operation
design-system copied to clipboard

button and button-icon not horizontally aligned correctly

Open FabienTaillon opened this issue 1 year ago • 5 comments

(REQUIRED) Include one or more screenshots if applicable, as well as a Codepen with the reduced test case.

buttons

I don't have a pro codepen account so I can't upload the svg as a static file but that doesn't change anything in the buttons not being aligned: https://codepen.io/FabienTaillon-the-lessful/pen/NWLbXvR

Describe the issue. Is it a bug or a feature request (new component, new icon, new CSS class)?

All buttons are correctly horizontally aligned except the button icon one, which is lower than the others.

Is this issue related to a specific component, variant, and/or state? If so, please detail which.

button icon

Are any specific browsers impacted by this bug?

I tried with Chrome and Safari and issue happens in both.

Which version of the Salesforce Lightning Design System are you using?

2.20.1, but same for previous versions I tried.

What steps and/or code are needed to reproduce this issue?

<html>
    <head>
        <link rel="stylesheet" href="assets/styles/salesforce-lightning-design-system.min.css"/>
    </head>
    <body class="slds-m-around_large">
        <button class="slds-button slds-button_neutral">Neutral Button</button>
        <button class="slds-button slds-button_brand">Button</button>
        <button class="slds-button slds-button_icon slds-button_icon-border-filled" title="Search">
            <svg class="slds-button__icon" aria-hidden="true">
                <use xlink:href="assets/icons/utility-sprite/svg/symbols.svg#search"></use>
            </svg>
            <span class="slds-assistive-text">Search</span>
        </button>
    </body>
</html>

What did you expect to happen?

All buttons are horizontally aligned.

What actually happened?

Button icon is lower than other buttons.

FabienTaillon avatar Feb 27 '23 10:02 FabienTaillon

I've been bugged with this issue for long as well, was going crazy trying to understand what changed in my apps.

vc4u avatar Apr 03 '23 20:04 vc4u

I think it's because of vertical-align property. I would open PR, but a bit busy at the moment to read all specs/contribution rules.

I think you can safely add vertical-align: middle to .slds-button component.

ondrejkonec avatar Apr 18 '23 03:04 ondrejkonec

Well I don't know if it's working as designed, but the workaround is working, thank you !

FabienTaillon avatar Apr 18 '23 08:04 FabienTaillon

@FabienTaillon you are welcome! I hope I can change it in code, but it take some time (because of tests etc.).

ondrejkonec avatar Apr 18 '23 11:04 ondrejkonec

The fix is already in Production, thank you efficient CI/CD 🙂 (and thank you again for letting me know how to fix it 👍).

FabienTaillon avatar Apr 18 '23 12:04 FabienTaillon