primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.58k stars 4.61k forks source link

pButton Directive: Button does not adapt to width the label requires on initial load #12462

Open silenum opened 1 year ago

silenum commented 1 year ago

Describe the bug

On the initial load of the application, the buttons do not adapt to the width required by the label.

image

When changing the view and switching back the buttons have the expected width.

image

Environment

I am using ngx-translate within the label declaration.

See the following code snippet as a representative example:

<button class="mt-3 mr-3 p-button-raised p-button-secondary"
        icon="fas fa-person-walking-arrow-right"
        label="{{'home.button.trail' | translate}}"
        pButton
        pRipple
        routerLink="/ctp/trail"
        type="button">
</button>

Reproducer

No response

Angular version

15.0.4

PrimeNG version

15.0.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.12.1

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

I would the buttons expect to render with the width the labels require on the initial load, so that they look as follows:

image

lkijak commented 1 year ago

Same for me, after going to the page the buttons have the correct width, but after refreshing the page their width decreases and a new style is added to them

.p-button.p-button-icon-only { width: 2.357rem; padding: 0.5 rem 0; }