Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal on:opening and on:open events are not firing #578

Open
pajohns opened this issue Oct 21, 2023 · 1 comment
Open

Modal on:opening and on:open events are not firing #578

pajohns opened this issue Oct 21, 2023 · 1 comment
Labels
Priority: Low Bug, issue, or pull request is a P3 Severity: Low Bug or issue is of low severity Type: Bug Something isn't working

Comments

@pajohns
Copy link

pajohns commented Oct 21, 2023

I have the following modal component...

<script <script>
    import { Modal } from "sveltestrap";
</script>

<Modal
    on:open={() => console.log('open')}
    on:opening={() => console.log('opening')}
    on:closing={() => console.log('closing')}
    on:close={() => console.log('close')}
    size="xl"
    isOpen={isOpen}
    contentClassName="modal-xl"
>

    <!-- Modal Content -->

</Modal>

When observing the console I note that when the modal is opened there are no log entries, however, when closing both the 'closing' and 'close' events are fired. I notice that they're tied to the on:introstart and on:introend events on the primary modal container but I'm unsure why they wouldn't be firing.

@pajohns
Copy link
Author

pajohns commented Oct 21, 2023

Update: I was able to work around this problem by removing the {#if _isMounted} line from the Modal.svelte file. It seems that it's a svelte issue with the introstart and introend events not firing if it's nested within double if statements that are being changed at the same time - race condition maybe? I moved them into a single if

{#if isOpen && _isMounted}

@dysfunc dysfunc added Type: Bug Something isn't working Priority: Low Bug, issue, or pull request is a P3 Severity: Low Bug or issue is of low severity labels Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low Bug, issue, or pull request is a P3 Severity: Low Bug or issue is of low severity Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants