refactor: extract shared form utils, add aria-live regions and reduced-motion support

DRY duplicated helpers (escapeAttr, belongsToForm, isSubmitControl,
isEditableTarget) into web/js/core/app-form-utils.js and update 7
consumers. Add aria-live="polite" to flash messages, async messages,
and search results for screen reader announcements. Add
prefers-reduced-motion support to CSS tooltips.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 22:28:46 +01:00
parent d9f07dcd63
commit 2b915f5a43
12 changed files with 72 additions and 119 deletions

View File

@@ -2,6 +2,7 @@
* Sidebar collapse/show toggle with localStorage persistence and Ctrl+B shortcut.
*/
import { requireEl, warnOnce } from '../core/app-dom.js';
import { isEditableTarget } from '../core/app-form-utils.js';
export function initSidebarToggle(options = {}) {
const {
@@ -150,13 +151,6 @@ export function initSidebarToggle(options = {}) {
return controller;
}
const isEditableTarget = (target) => {
if (!target) {return false;}
if (target.isContentEditable) {return true;}
const tag = target.tagName;
return tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT';
};
document.addEventListener('keydown', (event) => {
if (!(event.metaKey || event.ctrlKey)) {return;}
if (event.altKey) {return;}