Skip to content

Modal hide should call the provided on:close handler #1263

Closed
@danielo515

Description

@danielo515

Summary

Hello, thank you for this fantastic port to svelte.
I think the Modal component needs more flexibility for closing. It seems the only way right now is to provide a mutable variable that the modal can toggle.
There are situations where, the state of the modal is not directly binded to a simple boolean, but it is a derived value from some store or something like that.

Basic example

I have a modal that shows the currently selected "item", which is only open if such item is not null. There is no boolean to directly bind to (nor I want to have a separate boolean just for opening closing the modal). I tried binding a function to the on:close event, but it seems that your component does not call it for closing, just calls it's internal hide method that toggles (or tries to) the boolean.

Motivation

I want finer grained control over the modal open/close state

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions