fix(ui): accessibility, responsive, polish pass
This commit is contained in:
1 parent
20d523469d
commit
441a6a857e
4 files changed
+197
-7
No files matched your search
@@ -213,11 +213,14 @@ function initStatusPage(jobId, initialStatus) {
|
||||
var videoThumb = document.getElementById('video-thumb');
|
||||
var videoFallback = document.getElementById('video-fallback');
|
||||
|
||||
var progressRegion = document.getElementById('progress-section');
|
||||
var statusAnnouncer = document.getElementById('status-announcer');
|
||||
var terminalStates = ['COMPLETED', 'FAILED', 'CANCELLED'];
|
||||
var pollInterval = null;
|
||||
var previewInterval = null;
|
||||
var consecutiveFailures = 0;
|
||||
var connectionLostIndicator = null;
|
||||
var lastStatus = initialStatus;
|
||||
|
||||
if (!progressFill) return;
|
||||
|
||||
@@ -233,6 +236,11 @@ function initStatusPage(jobId, initialStatus) {
|
||||
updateModelName(data.current_model);
|
||||
updateResults(data.results);
|
||||
updateError(data.error);
|
||||
announceStatusChange(data.status, data.progress);
|
||||
|
||||
if (progressRegion) {
|
||||
progressRegion.setAttribute('aria-busy', data.status === 'RUNNING' || data.status === 'PENDING' ? 'true' : 'false');
|
||||
}
|
||||
|
||||
if (data.status === 'RUNNING' || data.status === 'PENDING') {
|
||||
updateLivePreview(jobId);
|
||||
@@ -342,6 +350,19 @@ function initStatusPage(jobId, initialStatus) {
|
||||
}
|
||||
}
|
||||
|
||||
/* --- Announce status changes to screen readers --- */
|
||||
function announceStatusChange(status, progress) {
|
||||
if (!statusAnnouncer) return;
|
||||
if (status === lastStatus) return;
|
||||
lastStatus = status;
|
||||
var pct = Math.min(100, Math.max(0, Math.round(progress * 100)));
|
||||
var msg = 'Job status changed to ' + status;
|
||||
if (status === 'RUNNING') msg += ', ' + pct + '% complete';
|
||||
if (status === 'COMPLETED') msg += '. Results are ready.';
|
||||
if (status === 'FAILED') msg += '. Job has failed.';
|
||||
statusAnnouncer.textContent = msg;
|
||||
}
|
||||
|
||||
/* --- Escape HTML for safe insertion --- */
|
||||
function escapeHtml(str) {
|
||||
var div = document.createElement('div');
|
||||
|
||||
Reference in new issue
Block a user