diff --git a/src/components/Controls/Icon.svelte b/src/components/Controls/Icon.svelte
index 0d9f533..1bd250e 100644
--- a/src/components/Controls/Icon.svelte
+++ b/src/components/Controls/Icon.svelte
@@ -8,5 +8,5 @@
diff --git a/src/components/Controls/Mute.svelte b/src/components/Controls/Mute.svelte
index 886c3b9..5d28d7f 100644
--- a/src/components/Controls/Mute.svelte
+++ b/src/components/Controls/Mute.svelte
@@ -31,6 +31,6 @@
};
-
+
+
diff --git a/src/components/Controls/PlayPause.svelte b/src/components/Controls/PlayPause.svelte
index f48f9b7..a99e5f7 100644
--- a/src/components/Controls/PlayPause.svelte
+++ b/src/components/Controls/PlayPause.svelte
@@ -11,6 +11,6 @@
};
-
+
+
diff --git a/src/components/Controls/Shuffle.svelte b/src/components/Controls/Shuffle.svelte
index 0da4e16..671a589 100644
--- a/src/components/Controls/Shuffle.svelte
+++ b/src/components/Controls/Shuffle.svelte
@@ -13,6 +13,6 @@
);
-
+
+
diff --git a/src/components/Controls/Switch.svelte b/src/components/Controls/Switch.svelte
index eb8f484..e94f704 100644
--- a/src/components/Controls/Switch.svelte
+++ b/src/components/Controls/Switch.svelte
@@ -8,6 +8,6 @@
const handleClick = () => forEachTrack(tracks, (track) => track.toggle());
-
+
+
diff --git a/src/components/SongList/Modal.svelte b/src/components/SongList/Modal.svelte
index 10124bc..b940612 100644
--- a/src/components/SongList/Modal.svelte
+++ b/src/components/SongList/Modal.svelte
@@ -10,39 +10,83 @@
let closed = false;
+ /* BEGIN FOCUS MANAGMENT */
+ // Ideally this would be provided by sv-popup
+
+ function focusModal() {
+ // using setTimeout as a hacky way to wait for the modal to render
+ setTimeout(() => {
+ // @ts-expect-error
+ document.querySelector("#song-selection-modal button[autofocus]").focus();
+ document.getElementById("app").setAttribute("inert", "");
+ });
+ }
+
+ function handleModalClose() {
+ document.getElementById("app").removeAttribute("inert");
+ document.getElementById("song-modal-trigger").focus();
+ }
+
+ function handleEscapeKey({ key }) {
+ if (key === "Escape") {
+ handleModalClose();
+ }
+ };
+
+ function handleClickOutside(event) {
+ if (event.target.classList.contains("modal__container")) {
+ handleModalClose();
+ }
+ }
+
+ /* END FOCUS MANAGMENT */
+
const setSong = (source, song) => {
$currentSong = new Song(source, song);
$appStarted = false;
closed = true;
+ handleModalClose();
};
+
+
+
Songs
- {#each Object.values(songs) as source}
+ {#each Object.values(songs) as source, sourceIndex}
{capitalise(source.name)}
- {#each Object.values(source.songs) as song}
+ {#each Object.values(source.songs) as song, songIndex}
- setSong(source.name, song.name)}
- on:keypress={() => setSong(source.name, song.name)}
+ class="mb-2 song transition-transform hover:scale-105"
>
-
-
![]()
setSong(source.name, song.name)}
+ >
+
+

-
-
-
{capitalise(song.name)}
+ />
+
+
+ {capitalise(song.name)}
+
{/each}
@@ -52,13 +96,13 @@
- (closed = false)}
- on:keypress={() => (closed = false)}
+ id="song-modal-trigger"
+ on:click={focusModal}
>
Now Playing:
{capitalise($currentSong.song)}
-
+