Skip to content

Commit 17c9ea8

Browse files
Dialog behaviour fixes (#240)
Only fire escape listener to close dialog while dialog is open. Stop calling open functions on app load.
1 parent 0c313d5 commit 17c9ea8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/dialogs/StandardDialog.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// Use curr so we don't call onCloseDialog() on page load.
3838
if (curr && !next) {
3939
onCloseDialog();
40-
} else {
40+
} else if (!curr && next) {
4141
onOpenDialog();
4242
}
4343
return next;
@@ -55,7 +55,7 @@
5555
});
5656
5757
const keyListener = (event: KeyboardEvent) => {
58-
if (event.key === 'Escape') {
58+
if (event.key === 'Escape' && isOpen) {
5959
onCloseDialog();
6060
}
6161
};
@@ -75,7 +75,7 @@
7575
$: sync.open(isOpen, v => (isOpen = v));
7676
7777
let prevOpen: boolean;
78-
$: if (isOpen) {
78+
$: if (!prevOpen && isOpen) {
7979
onOpenDialog();
8080
prevOpen = isOpen;
8181
} else if (prevOpen && !isOpen) {

0 commit comments

Comments
 (0)