mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-11-04 03:52:34 +00:00
fix(web_viewer): announce connection changes and let the log stream take focus
The navbar's connection text changed silently, so a screen-reader user wasn't told when the viewer lost or regained its link to the bot. It becomes a status region after the first update, which keeps the routine connect on every page load quiet and announces later changes; it's only rewritten when the text actually changes. The Logs stream scrolls but couldn't take focus, so keyboard users couldn't scroll it. It is now a focusable region named "Bot log stream". It is deliberately not a live region: announcing every log line would drown everything else.
This commit is contained in:
1 parent
02868841dd
commit
da2bb91226
2 files changed
+7
-2
No files matched your search
@@ -1277,8 +1277,13 @@
|
||||
const statusElement = document.getElementById('connection-text');
|
||||
const indicatorElement = document.getElementById('connection-status');
|
||||
|
||||
if (statusElement) {
|
||||
if (statusElement && statusElement.textContent !== text) {
|
||||
statusElement.textContent = text;
|
||||
// Announce later changes (a dropped or restored link), but
|
||||
// not the first connect every page load makes.
|
||||
if (!statusElement.hasAttribute('role')) {
|
||||
statusElement.setAttribute('role', 'status');
|
||||
}
|
||||
}
|
||||
if (indicatorElement) {
|
||||
indicatorElement.className = `status-indicator status-${status}`;
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div id="log-container" class="log-container">
|
||||
<div id="log-container" class="log-container" tabindex="0" role="region" aria-label="Bot log stream">
|
||||
<div class="text-muted py-3 text-center" id="log-placeholder">
|
||||
<i class="fas fa-hourglass-half"></i> Waiting for log data…
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user