Merge pull request #49 into main

This commit is contained in:
2026-11-24 20:19:26 +01:00
2 changed files with 8 additions and 4 deletions
+7 -3
View File
@@ -1249,7 +1249,7 @@ async function router() {
if (ex.status === 401) { showLogin(); return; }
C.innerHTML = ex.status === 404
? '<div class="empty">Nie znaleziono strony.</div>'
: `<div class="banner err">${esc(ex.message)}</div>`;
: `<div class="banner err" role="alert">${esc(ex.message)}</div>`;
}
localize(C);
renderNav();
@@ -6376,8 +6376,11 @@ function modal(title, sub, bodyHtml, actionsHtml, opts) {
if (!_modalOpener && document.activeElement && document.activeElement !== document.body
&& !$('modalRoot').contains(document.activeElement)) _modalOpener = document.activeElement;
// A field if there is one; otherwise the dialog's first control, so a keyboard user starts inside.
const first = $('modalRoot').querySelector('input:not([type=hidden]),select,textarea')
|| $('modalRoot').querySelector('.modal button, .modal a[href]');
// Only one that is rendered: a display:none row (the account sheet's .m-only ones on a desktop)
// takes no focus, and focus would stay behind on the now-inert page.
const shown = (el) => el.getClientRects().length > 0;
const first = [...$('modalRoot').querySelectorAll('input:not([type=hidden]),select,textarea')].find(shown)
|| [...$('modalRoot').querySelectorAll('.modal button, .modal a[href]')].find(shown);
if (first) first.focus();
}
@@ -6388,6 +6391,7 @@ function modalError(msg) {
if (!el) {
el = document.createElement('div');
el.className = 'banner err';
el.setAttribute('role', 'alert');
b.prepend(el);
}
el.textContent = msg;
+1 -1
View File
@@ -40,7 +40,7 @@
<button type="button" class="pw-eye" id="pwToggleLogin" title="Pokaż hasło" aria-label="Pokaż hasło"></button>
</span>
</label>
<div id="loginErr" class="banner err hidden"></div>
<div id="loginErr" class="banner err hidden" role="alert"></div>
<button class="btn primary" id="btnLogin" type="submit">Zaloguj się</button>
</form>
</div>