On closing a slide-over modal unable to listen to "close-modal" event

Hi !

I'm using a custom modal, by calling :
<x-filament::modal slide-over sticky-header sticky-footer width="5xl" id="my-modal">

<p>Here's my content</p>

</x-filament::modal>


But on listening to the close-modal event nothing happens.

Here the JS code:

document.addEventListener('livewire:initialized', () => {
  Livewire.on('close-modal', ({id}) => {
  
      console.log('close-modal');
  
      if (id === 'my-modal') {
          Livewire.dispatch('bot::unsubscribe');
      }
  });
});


Is this a Filament bug, or have I missed something?

Thanks for you help !

Best regards.
Was this page helpful?