F
Filament15mo ago
3rgo

Custom widget collapsible section does not work

I'm building a custom widget to display in a form header, and I'm using the x-filament::section helper from the core documentation (https://filamentphp.com/docs/3.x/support/blade-components/section), and the collapsibleflag does not seem to work, I get the following AlpineJS error :
Alpine Expression Error: isCollapsed is not defined Expression: "{ 'invisible h-0 border-none': isCollapsed }"
Here is my code, I didn't do anything too fancy yet :
<x-filament-widgets::widget>
<x-filament::section icon="fas-calendar-check" collapsible>
<x-slot name="heading">
{{ __('attributes.attributions') }}
</x-slot>

{{-- Content --}}
Test
</x-filament::section>
</x-filament-widgets::widget>
<x-filament-widgets::widget>
<x-filament::section icon="fas-calendar-check" collapsible>
<x-slot name="heading">
{{ __('attributes.attributions') }}
</x-slot>

{{-- Content --}}
Test
</x-filament::section>
</x-filament-widgets::widget>
When I check the HTML code, the x-data directive is present on the section root element with the boolean in it, I don't know what went wrong Everything is up to date on Composer and NPM (did the v3 upgrade earlier today)
7 Replies
3rgo
3rgoOP15mo ago
FWIW, if I put another section (collapsible) in the content, the child collapse works but not the parent
GDG
GDG15mo ago
This broke for me in one of the last couple of releases too. The collapse/expand button reacts to the actions but the content area just remains open or closed depending on the default state.
cheesegrits
cheesegrits15mo ago
If it's a definite bug, please raise a github issue. Turns out I can replicate this in one of my apps. Seems to be a LW3/Alpine issue. I've found a workaround, which I've PR'ed on Filament. Don't know if Dan will merge it, or has a better solution. I'll let you know what happens. I need a fix for this for my Maps plugin widget. Yup, that's the exact behavior I found as well. Hopefully the PR will get merged.
3rgo
3rgoOP15mo ago
Can you link the PR please ? I can upvote it
cheesegrits
cheesegrits15mo ago
@3rgo the PR got merged and included in today's version update, so a composer update should resolve it for you.
3rgo
3rgoOP15mo ago
Thanks for the heads I'll try it ASAP
cheesegrits
cheesegrits15mo ago
Note that I think there may still be issues with 'collapsed' attribute (start collapsed), although 'collapsible' itself is now working. The fix I pR'ed really is just a temporary hack to work round what definitely seems to be a bug in LW3/Alpine.
Want results from more Discord servers?
Add your server