utopia-ia/elffuss-claw public
Changesets · Branches · Tags · Compare
| Changeset | a66d895df8ecd81429f14bd32ac17ed602fce8b64ecbe3fb5e5cc98c95d3926c |
|---|---|
| Author | KikoCis <kikocisneros@gmail.com> · 2026-10-10 17:08 +02:00 |
| Committer | KikoCis <kikocisneros@gmail.com> · 2026-10-11 17:49 +02:00 |
| Parents | dad0705960bd |
1 file changed
modified web/js/loading-stage.js +9 −4
| @@ -27,8 +27,8 @@ | ||
| 27 | 27 | </div> |
| 28 | 28 | <div class="ls-head">Preparando tu sistema operativo…</div> |
| 29 | 29 | <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> | |
| 32 | 32 | </div> |
| 33 | 33 | </div>`); |
| 34 | 34 | panel.appendChild(root); |
| @@ -64,17 +64,22 @@ | ||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // 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 %). | |
| 67 | 69 | export function setProgress(p) { |
| 68 | 70 | if (!root) return; |
| 69 | 71 | 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))); }; | |
| 70 | 74 | if (typeof p === 'number' && isFinite(p)) { |
| 71 | 75 | bar.classList.remove('indet'); bar.style.width = Math.max(2, Math.min(100, p)) + '%'; |
| 72 | 76 | txt.textContent = `Descargando el cerebro · ${Math.round(p)}%`; |
| 77 | + valor(Math.min(100, p)); | |
| 73 | 78 | } else if (typeof p === 'string') { |
| 74 | 79 | // extraer un % si el string lo trae («… 42%…»), si no barra indeterminada |
| 75 | 80 | 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); } | |
| 78 | 83 | txt.textContent = p; |
| 79 | 84 | } |
| 80 | 85 | } |