Frontend: structured error handling, state fixes, accessibility, i18n

- Enhance fetchWithAuth with auto-401, retry w/ exponential backoff, timeout
- Remove ~40 manual 401 checks across 10 feature files
- Fix state: brightness cache setter, manual edit flag resets, static import
- Add ARIA: role=dialog/tablist, aria-modal, aria-labelledby, aria-selected
- Add focus trapping in Modal base class, aria-expanded on hint toggles
- Fix WCAG AA color contrast with --primary-text-color variable
- Add i18n pluralization (CLDR rules for en/ru), getCurrentLocale export
- Replace hardcoded strings in dashboard.js and profiles.js
- Add data-i18n-aria-label support, 20 new keys in en.json and ru.json

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-20 01:18:29 +03:00
parent 2b90fafb9c
commit 3ae20761a1
41 changed files with 355 additions and 248 deletions

View File

@@ -20,7 +20,7 @@ import {
_lastValidatedImageSource, set_lastValidatedImageSource,
apiKey,
} from '../core/state.js';
import { API_BASE, getHeaders, fetchWithAuth, escapeHtml, handle401Error } from '../core/api.js';
import { API_BASE, getHeaders, fetchWithAuth, escapeHtml } from '../core/api.js';
import { t } from '../core/i18n.js';
import { Modal } from '../core/modal.js';
import { showToast, showConfirm, openLightbox, openFullImageLightbox, showOverlaySpinner, hideOverlaySpinner } from '../core/ui.js';
@@ -105,6 +105,7 @@ export async function editTemplate(templateId) {
export function closeTemplateModal() {
templateModal.forceClose();
setCurrentEditingTemplateId(null);
set_templateNameManuallyEdited(false);
}
function updateCaptureDuration(value) {
@@ -900,6 +901,7 @@ export async function deleteStream(streamId) {
export function closeStreamModal() {
streamModal.forceClose();
document.getElementById('stream-type').disabled = false;
set_streamNameManuallyEdited(false);
}
async function validateStaticImage() {
@@ -1375,6 +1377,7 @@ export async function deletePPTemplate(templateId) {
export function closePPTemplateModal() {
ppTemplateModal.forceClose();
set_modalFilters([]);
set_ppTemplateNameManuallyEdited(false);
}
// Exported helpers used by other modules