From 46573728dc64ddb608ae978fae520e495f486e7d Mon Sep 17 00:00:00 2001 From: Wesley B <62723358+wesleyboar@users.noreply.github.com> Date: Mon, 8 Jun 2026 12:52:14 -0500 Subject: [PATCH 1/2] feat(_utils): add promote-data-aria-attributes for WYSIWYG HTML Editors that strip aria-* on publish can keep data-aria-*; callers run this once on a scope root before scripts that depend on real ARIA attributes. Co-authored-by: Cursor --- .../_utils/js/promote-data-aria-attributes.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/lib/_utils/js/promote-data-aria-attributes.js diff --git a/src/lib/_utils/js/promote-data-aria-attributes.js b/src/lib/_utils/js/promote-data-aria-attributes.js new file mode 100644 index 000000000..ace70b37a --- /dev/null +++ b/src/lib/_utils/js/promote-data-aria-attributes.js @@ -0,0 +1,33 @@ +/** + * Copy `data-aria-*` attributes to matching `aria-*` on the same nodes. + * For HTML saved through WYSIWYG editors that strip unprefixed ARIA on publish. + * + * @param {ParentNode | null | undefined} [root=document] + */ +export default function promoteDataAriaAttributes(root = document) { + if (!root) { + return; + } + + const elements = + root instanceof Document + ? root.querySelectorAll('*') + : root instanceof Element + ? [ root, ...root.querySelectorAll('*') ] + : []; + + for (const el of elements) { + if (!(el instanceof Element)) { + continue; + } + for (const attr of [ ...el.attributes ]) { + if (!attr.name.startsWith('data-aria-')) { + continue; + } + el.setAttribute( + 'aria-' + attr.name.slice('data-aria-'.length), + attr.value + ); + } + } +} From 89d5b13a30de2c74ec9f1590d28d3ac70638fa85 Mon Sep 17 00:00:00 2001 From: Wesley B <62723358+wesleyboar@users.noreply.github.com> Date: Mon, 8 Jun 2026 13:30:54 -0500 Subject: [PATCH 2/2] docs(.gitmessage): be succinct --- .gitmessage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmessage b/.gitmessage index f9fe1d135..8b870730c 100644 --- a/.gitmessage +++ b/.gitmessage @@ -12,8 +12,8 @@ # style: delete excess whitespace # # Body (optional): -# What changed and why -# Important design decisions or context +# what changed (1 sentence) +# (if relevant) important decisions/context (succinct bullets) # # Footer (optional): # BREAKING CHANGE: describe breaking change