You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@edwinvdpol thanks for reporting! I had a quick dig to see if I could find a simple solution to this. But I think it's going to need @calebporzio's input.
Here's a Volt component that shows both the bad and good scenarios and a small description of the issue and what I found.
<?phpuseLivewire\Volt\Component;newclassextendsComponent {public$show=true;publicfunctiontest() {sleep(5); }};?>
<div>
<p>This one demonstrates the problem:</p>
<flux:buttonicon="arrow-path"variant="primary"wire:click="test">
{{-- `sm:inline` normally added here to show icon and "Refresh" label on desktop and icon only on mobile --}}{{-- Setting to just `hidden` allows us to see the problem on desktop --}}
<spanclass="hidden">Refresh</span>
</flux:button>
<p>This shows it working fine when we remove `wire:click`:</p>
<flux:buttonicon="arrow-path"variant="primary">
{{-- `sm:inline` normally added here to show icon and "Refresh" label on desktop and icon only on mobile --}}{{-- Setting to just `hidden` allows us to see the problem on desktop --}}
<spanclass="hidden">Refresh</span>
</flux:button>
<p>
The problem is due to the `wire:click` on the first button, the button component wraps the slot in a<br />
`<span></span>` to ensure there is a target element to change the opacity of the button contents<br />
when `wire:loading` is running and the loading element is shown. But this is a `gap-2` applied to<br />
the button which is being shown even when there are no slot contents, due to the wrapping span.
</p>
</div>
Flux version
v1.0.29
Livewire version
v3.5.16
What is the problem?
Hit there 👋
Given the code below, the icon in the button is not centered when using hidden content.
When removing the
wire:click
attribute from the button, it is centered.I think the loading spinner, or the extra span is what causes this behaviour.
Code snippets
How do you expect it to work?
It should be centered like this:
A nice to have, is that it also should behave like the
square
variant, but I can image that would be complicated. 😉Please confirm (incomplete submissions will not be addressed)
The text was updated successfully, but these errors were encountered: