DEV: Don't add 0-width char if there's no icon in d-button (#26880)

Previously, if you supplied your own content to DButton it would still add the character:

```hbs
<DButton>my text</DButton>
```

```html
<button>&#8203; my text</button>
```
This commit is contained in:
Jarek Radosz 2024-05-06 20:52:11 +02:00 committed by GitHub
parent 378faf060d
commit d8b1c3c807
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 9 deletions

View File

@ -178,15 +178,13 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView {
>
{{#if @isLoading}}
{{~icon "spinner" class="loading-icon"~}}
{{else}}
{{#if @icon}}
{{#if @ariaHidden}}
<span aria-hidden="true">
{{~icon @icon~}}
</span>
{{else}}
{{else if @icon}}
{{#if @ariaHidden}}
<span aria-hidden="true">
{{~icon @icon~}}
{{/if}}
</span>
{{else}}
{{~icon @icon~}}
{{/if}}
{{/if}}
@ -197,7 +195,7 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView {
&hellip;
{{~/if~}}
</span>
{{~else~}}
{{~else if (or @icon @isLoading)~}}
&#8203;
{{! Zero-width space character, so icon-only button height = regular button height }}
{{~/if~}}