From 58ca3014d8d450e18d31e6e22fbaf9db37fe432b Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Sat, 6 Jun 2026 20:45:13 +0530 Subject: [PATCH] fix(modals): drop shadcn-style aria-describedby to silence Radix warning Every DialogContent had aria-describedby="X-desc" and every DialogDescription had a matching id="X-desc". That pattern is the default shadcn/ui recipe, but it breaks Radix 1.1.x. Root cause: Radix auto-generates a descriptionId via useId() (e.g. :r0:) and stores it in the Dialog context. The DescriptionWarning effect does `document.getElementById(descriptionId)` and warns if the element is missing. When the description element's id is overridden to "welcome-desc", the DOM has id="welcome-desc" but the context still has :r0:, so the lookup misses and the warning fires on every dialog open. Fix: drop both overrides. Let Radix manage the id and aria-describedby itself. Screen-reader semantics are unchanged (Radix still wires Content -> Description via the auto-generated id). Touched: 12 modal files (11 DialogContent/DialogDescription pairs + SettingsSheet which uses Sheet). +1 regression test in WelcomeDialog.test.tsx that spies on console.warn and asserts the "Missing Description" message is never emitted. Tests: 306/306 pass (was 305). Long-term memory: radix-aria-describedby-anti-pattern.md captures the do-not-reintroduce rule for future agents. --- .../components/modals/AboutDialog.tsx | 4 ++-- .../modals/AsciiGeneratorDialog.tsx | 4 ++-- .../components/modals/ConfirmDialog.tsx | 4 ++-- .../components/modals/ExportBatchDialog.tsx | 4 ++-- .../components/modals/ExportDocxDialog.tsx | 4 ++-- .../components/modals/ExportHtmlDialog.tsx | 4 ++-- .../components/modals/ExportPdfDialog.tsx | 4 ++-- .../components/modals/FindInFilesDialog.tsx | 4 ++-- .../components/modals/SettingsSheet.tsx | 4 ++-- .../modals/TableGeneratorDialog.tsx | 4 ++-- .../components/modals/WelcomeDialog.tsx | 4 ++-- .../components/modals/WordExportDialog.tsx | 4 ++-- tests/component/modals/WelcomeDialog.test.tsx | 23 +++++++++++++++++++ 13 files changed, 47 insertions(+), 24 deletions(-) diff --git a/src/renderer/components/modals/AboutDialog.tsx b/src/renderer/components/modals/AboutDialog.tsx index bd7c9ed..f8679bd 100644 --- a/src/renderer/components/modals/AboutDialog.tsx +++ b/src/renderer/components/modals/AboutDialog.tsx @@ -17,10 +17,10 @@ export function AboutDialog() { return ( !o && closeModal()}> - + About MarkdownConverter - + Professional Markdown editor and universal file converter. diff --git a/src/renderer/components/modals/AsciiGeneratorDialog.tsx b/src/renderer/components/modals/AsciiGeneratorDialog.tsx index 4938ea5..36a7921 100644 --- a/src/renderer/components/modals/AsciiGeneratorDialog.tsx +++ b/src/renderer/components/modals/AsciiGeneratorDialog.tsx @@ -33,10 +33,10 @@ export function AsciiGeneratorDialog() { return ( !o && closeModal()}> - + ASCII generator - Type text, pick a font, see ASCII art + Type text, pick a font, see ASCII art
diff --git a/src/renderer/components/modals/ConfirmDialog.tsx b/src/renderer/components/modals/ConfirmDialog.tsx index f082d5f..4acbbd5 100644 --- a/src/renderer/components/modals/ConfirmDialog.tsx +++ b/src/renderer/components/modals/ConfirmDialog.tsx @@ -17,10 +17,10 @@ export function ConfirmDialog(props: ConfirmProps) { return ( !o && handleCancel()}> - + {title} - {body} + {body}