Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: enhance ChangelogDialog accessibility with focus management and ARIA attributes

Tonho4672ed98d6e5
diff --git a/src/components/dialog/ChangelogDialog.svelte b/src/components/dialog/ChangelogDialog.svelte
index 2f38d027..5b6aca4a 100644
--- a/src/components/dialog/ChangelogDialog.svelte
+++ b/src/components/dialog/ChangelogDialog.svelte
@@ -13,9 +13,11 @@
let dialogEl = $state<HTMLDialogElement | null>(null);
let closing = $state(false);
+ let previousFocusEl = $state<HTMLElement | null>(null);
$effect(() => {
if (visible && dialogEl && !dialogEl.open) {
+ previousFocusEl = document.activeElement as HTMLElement;
dialogEl.showModal();
}
});
@@ -26,6 +28,8 @@
closing = false;
dialogEl?.close();
dismissChangelog();
+ previousFocusEl?.focus();
+ previousFocusEl = null;
}, 150);
}
@@ -84,6 +88,8 @@
bind:this={dialogEl}
class="changelog-dialog"
class:closing
+ aria-labelledby="changelog-title"
+ aria-modal="true"
onclick={handleBackdropClick}
oncancel={(e) => {
e.preventDefault();
@@ -93,7 +99,7 @@
<div class="dialog-content">
<div class="dialog-header">
<div class="dialog-title-row">
- <h3>{$t("changelog.title")}</h3>
+ <h3 id="changelog-title">{$t("changelog.title")}</h3>
{#if version}
<span class="version-badge">v{version}</span>
{/if}