Elffuss BraidHub

utopia-ia/elffuss-claw public

Download showcase: its progress bar is a progressbar with a value

The showcase's bar was a styled div: role=progressbar, labelled by the progress
text, with aria-valuenow when the percentage is known (removed while it is
indeterminate).
Changeseta66d895df8ecd81429f14bd32ac17ed602fce8b64ecbe3fb5e5cc98c95d3926c
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-10 17:08 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-11 17:49 +02:00
Parentsdad0705960bd

Browse the files at this changeset

1 file changed

modified web/js/loading-stage.js +9 −4
@@ -27,8 +27,8 @@
2727 </div>
2828 <div class="ls-head">Preparando tu sistema operativo…</div>
2929 <div class="ls-sub">el cerebro se descarga una vez y corre <b>en tu máquina</b>. Mientras, mira lo que sabe construir:</div>
30- <div class="ls-prog"><div class="ls-bar indet"></div></div>
31- <div class="ls-progtext">Descargando…</div>
30+ <div class="ls-prog" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-labelledby="ls-progtext"><div class="ls-bar indet"></div></div>
31+ <div class="ls-progtext" id="ls-progtext">Descargando…</div>
3232 </div>
3333 </div>`);
3434 panel.appendChild(root);
@@ -64,17 +64,22 @@
6464 }
6565
6666 // progreso: número (%) → barra determinada; string → barra indeterminada + texto.
67+// La barra es una barra de progreso también para un lector de pantalla
68+// (role=progressbar con aria-valuenow cuando se sabe el %).
6769 export function setProgress(p) {
6870 if (!root) return;
6971 const bar = root.querySelector('.ls-bar'), txt = root.querySelector('.ls-progtext');
72+ const prog = root.querySelector('.ls-prog');
73+ const valor = v => { if (v == null) prog.removeAttribute('aria-valuenow'); else prog.setAttribute('aria-valuenow', String(Math.round(v))); };
7074 if (typeof p === 'number' && isFinite(p)) {
7175 bar.classList.remove('indet'); bar.style.width = Math.max(2, Math.min(100, p)) + '%';
7276 txt.textContent = `Descargando el cerebro · ${Math.round(p)}%`;
77+ valor(Math.min(100, p));
7378 } else if (typeof p === 'string') {
7479 // extraer un % si el string lo trae («… 42%…»), si no barra indeterminada
7580 const m = p.match(/(\d+)\s*%/);
76- if (m) { bar.classList.remove('indet'); bar.style.width = m[1] + '%'; }
77- else { bar.classList.add('indet'); bar.style.width = ''; }
81+ if (m) { bar.classList.remove('indet'); bar.style.width = m[1] + '%'; valor(+m[1]); }
82+ else { bar.classList.add('indet'); bar.style.width = ''; valor(null); }
7883 txt.textContent = p;
7984 }
8085 }