Closed mquandalle closed 2 years ago
It seems that this bug was introduced in #31.
Sorry for the glitch and thanks for reporting the issue. Can you test it with the following version of the Modal?
https://svelte.dev/repl/2eb021eff87d45019549565136b0e6ed?version=3.44.1
In my local tests with your repo this fixes the issue.
Yes it fixes the issue.
The problem was indeed the reactivity of isMounted
variable in the following block, causing close()
to be called on mount:
https://github.com/flekschas/svelte-simple-modal/blob/43bb9c19a69965843a525289a4e0aea3a854e77d/src/Modal.svelte#L201-L219
New version with a fix is out
Thank you for the quick fix!
When the
Modal
component is used, the page is scrolled to the top on first load, or during in-app navigation. This is unwanted in case we link to an anchor.Reproduction : https://repro-svelte-simple-modal-anchor-issue-maximequandalle.vercel.app/#anchor Source : https://github.com/mquandalle/repro-svelte-simple-modal-anchor-issue/blob/master/src/routes/index.svelte