From 8e9f5362b768816ed00f4d8ef2e45c5d6e514fee Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 22 May 2026 00:24:01 -0400 Subject: [PATCH] Fix Skald accessibility audit issues --- static/skald.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/static/skald.js b/static/skald.js index 182a28a..12013ea 100644 --- a/static/skald.js +++ b/static/skald.js @@ -265,7 +265,7 @@ function reflectSettings() { /** @type {AudioContext} */ let notificationAudioContext = null; let userNotificationSoundsReady = false; -let notificationSoundGainScale = 7.5; +let notificationSoundGainScale = 15; function notificationSoundsEnabled() { return !!getSettings().notificationSounds; @@ -1835,22 +1835,20 @@ function setUserStatus(id, elt, userinfo, notify) { elt.textContent = username; let wasRaised = elt.classList.contains('user-status-raisehand'); - let isRemote = id !== (serverConnection && serverConnection.id); if(userinfo.data.raisehand) { elt.classList.add('user-status-raisehand'); elt.setAttribute('aria-label', `${username} (hand raised)`); if(notify && !wasRaised) { - let announcement = document.getElementById('chat-announcements'); - if(announcement && isRemote) { - announcement.textContent = `${username} raised their hand`; - } + announceUrgent(`${username} raised their hand`); playNotificationSound('hand-raised'); } } else { elt.classList.remove('user-status-raisehand'); elt.setAttribute('aria-label', username); - if(notify && wasRaised) + if(notify && wasRaised) { + announceUrgent(`${username} lowered their hand`); playNotificationSound('hand-lowered'); + } } let microphone=false; @@ -3623,9 +3621,12 @@ function setAccessibleHidden(elt, hidden) { function openNav() { let sidebarnav = document.getElementById("sidebarnav"); let openside = document.getElementById("openside"); + let closeside = document.getElementById("closeside"); sidebarnav.style.width = "250px"; setAccessibleHidden(sidebarnav, false); openside.setAttribute("aria-expanded", "true"); + if(closeside) + closeside.focus(); } function closeNav() { @@ -3688,6 +3689,7 @@ document.getElementById('close-chat').onclick = function(e) { setVisibility('left', false); setVisibility('show-chat', true); resizePeers(); + document.getElementById('show-chat').focus(); }; document.getElementById('close-chat').onkeydown = function(e) { @@ -3696,6 +3698,7 @@ document.getElementById('close-chat').onkeydown = function(e) { setVisibility('left', false); setVisibility('show-chat', true); resizePeers(); + document.getElementById('show-chat').focus(); } }; @@ -3704,6 +3707,7 @@ document.getElementById('show-chat').onclick = function(e) { setVisibility('left', true); setVisibility('show-chat', false); resizePeers(); + document.getElementById('close-chat').focus(); }; document.getElementById('show-chat').onkeydown = function(e) { @@ -3712,6 +3716,7 @@ document.getElementById('show-chat').onkeydown = function(e) { setVisibility('left', true); setVisibility('show-chat', false); resizePeers(); + document.getElementById('close-chat').focus(); } }; @@ -3809,12 +3814,6 @@ document.addEventListener('keydown', function(e) { {'raisehand': isRaised ? null : true} ); - // Announce the action - let announcement = document.getElementById('chat-announcements'); - if(announcement) { - announcement.textContent = isRaised ? 'Hand lowered' : 'Hand raised'; - } - // Focus on user's name button in the user list (delayed to ensure announcement is read) setTimeout(function() { let userButton = document.getElementById('user-' + serverConnection.id); @@ -3832,8 +3831,7 @@ document.addEventListener('keydown', function(e) { let showChatButton = document.getElementById('show-chat'); let closeChatButton = document.getElementById('close-chat'); - // Check if chat is currently visible - let isChatVisible = leftPanel && leftPanel.style.display !== 'none'; + let isChatVisible = leftPanel && !leftPanel.classList.contains('invisible'); if(isChatVisible) { // Collapse chat