wire-elements / modal

Livewire component that provides you with a modal that supports multiple child modals while maintaining state.
https://wire-elements.dev
MIT License
1.13k stars 133 forks source link

x-on:keydown.escape from a custom component triggers closeModal on LivewireUiModal #476

Closed chatisk closed 3 hours ago

chatisk commented 3 hours ago

Greetings,

I have an off-canvas from jetstream which I have added long time ago, the x-on:keydown.escape.window listener to close the offcanvas. Since the page uses the layout that has registered the scripts for the wire ui modal, the scripts of the wire ui modal are present as well. So whenever i try to close the off canvas with the escape key, I get in the console

Cannot read properties of undefined (reading 'name') Expression: "closeModalOnEscape()"

I believe the scripts should try to close a modal if there is any active component. I am using the alpine js tools of chrome extension, and the alpine state doesn't have any active component (neither do i have any livewire component extending the ModalComponent).

Version is 2.0.12

EDIT: I just press escape key on a page that uses the scripts of the wire ui modal and i get this error (I dont have any ModalComponent present in the page)

EDIT2: Both set to false, still getting the error

'close_modal_on_escape' => false,

'close_modal_on_escape_is_forceful' => false,
chatisk commented 3 hours ago

Sorry I had published the view and i didn't update it. If someone has published the view of the modal, check this commit and do the change manually