fix(bulk-upload): populate aria-live region with active file title
The sr-only aria-live div was always empty, so screen readers never announced file switches. Derived activeAnnouncement from the active entry and bound it to the div's text content. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,8 @@ let {
|
|||||||
let trackEl = $state<HTMLDivElement | null>(null);
|
let trackEl = $state<HTMLDivElement | null>(null);
|
||||||
let listEl = $state<HTMLUListElement | null>(null);
|
let listEl = $state<HTMLUListElement | null>(null);
|
||||||
|
|
||||||
|
const activeAnnouncement = $derived(files.find((f) => f.id === activeId)?.title ?? '');
|
||||||
|
|
||||||
function scrollPrev() {
|
function scrollPrev() {
|
||||||
trackEl?.scrollBy({ left: -120, behavior: 'smooth' });
|
trackEl?.scrollBy({ left: -120, behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
@@ -58,7 +60,7 @@ $effect(() => {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div aria-live="polite" aria-atomic="true" class="sr-only"></div>
|
<div aria-live="polite" aria-atomic="true" class="sr-only">{activeAnnouncement}</div>
|
||||||
<div
|
<div
|
||||||
data-testid="file-switcher-strip"
|
data-testid="file-switcher-strip"
|
||||||
class="flex h-11 shrink-0 items-center gap-1 border-t border-line bg-pdf-ctrl px-2"
|
class="flex h-11 shrink-0 items-center gap-1 border-t border-line bg-pdf-ctrl px-2"
|
||||||
|
|||||||
Reference in New Issue
Block a user