From 4961c5df21260cb34e9a60a2244812cc1687680e Mon Sep 17 00:00:00 2001 From: Margarita Barvinok Date: Thu, 19 Mar 2026 09:33:56 -0400 Subject: [PATCH] add patch for trix editor --- app/javascript/trixeditorpatch.js | 294 +++++++++++++++++++++++++ app/views/layouts/application.html.erb | 1 + 2 files changed, 295 insertions(+) create mode 100644 app/javascript/trixeditorpatch.js diff --git a/app/javascript/trixeditorpatch.js b/app/javascript/trixeditorpatch.js new file mode 100644 index 00000000..596c8148 --- /dev/null +++ b/app/javascript/trixeditorpatch.js @@ -0,0 +1,294 @@ +/* Trix A11Y Patch v3 (WCAG 2.1 AA) + - Hit area fix (pseudo-elements can't steal clicks) + - Roving tabindex (Tab enters/leaves, Arrows move, Home/End jump) + - Robust keyboard activation (synth pointer+mouse+click) + - aria-pressed/aria-disabled sync; toolbar/dialog/editor semantics +*/ +(function trixA11yV3(){ + if (window.__trixA11yV3Applied) return; + window.__trixA11yV3Applied = true; + + // ---------- Inject CSS ---------- + const STYLE_ID = 'trix-a11y-v3-styles'; + if (!document.getElementById(STYLE_ID)) { + const s = document.createElement('style'); + s.id = STYLE_ID; + s.textContent = ` + /* Make the actual