From 309dde5423d6198e0f58ff003799233e425abb42 Mon Sep 17 00:00:00 2001 From: AK <144495202+AKnassa@users.noreply.github.com> Date: Mon, 3 Aug 2026 13:55:56 -0400 Subject: [PATCH] fix(a11y): name RichTextEditor editable surfaces axe flagged every RichTextEditor story (aria-input-field-name, 12 serious + 1 critical label): the editor pointed aria-labelledby at an id no element carried, RichTextView's read-only textbox had no name at all, and one story shipped a bare textarea. - point aria-labelledby at the label element via Field's labelID, and give the contenteditable the control id htmlFor expects - add a label prop to RichTextView (default 'Rich text content'), mirroring RichTextEditorToolbar's label default - label the Markdown Serializers story textarea - burn 13 fixed entries out of .github/a11y-baseline.json (226->213) Verified: 53/53 lab tests, lab typecheck:docs, storybook typecheck, and the full axe audit on all 12 stories - 0 violations, gate green. Part of #4681. --- .github/a11y-baseline.json | 65 ------------------- .../stories/RichTextEditor.stories.tsx | 20 ++++-- .../RichTextEditor/RichTextEditor.test.tsx | 25 +++++++ .../lab/src/RichTextEditor/RichTextEditor.tsx | 14 +++- .../lab/src/RichTextEditor/RichTextView.tsx | 13 +++- 5 files changed, 60 insertions(+), 77 deletions(-) diff --git a/.github/a11y-baseline.json b/.github/a11y-baseline.json index 84e9c710ad67..3f3bfdeabeed 100644 --- a/.github/a11y-baseline.json +++ b/.github/a11y-baseline.json @@ -803,71 +803,6 @@ "impact": "serious", "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/color-contrast?application=playwright" }, - { - "key": "RichTextEditor::Controlled Persistence::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, - { - "key": "RichTextEditor::Custom Transformers::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, - { - "key": "RichTextEditor::Default::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, - { - "key": "RichTextEditor::Error Status::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, - { - "key": "RichTextEditor::Imperative Ref::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, - { - "key": "RichTextEditor::Markdown Serializers::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, - { - "key": "RichTextEditor::Markdown Serializers::label", - "impact": "critical", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/label?application=playwright" - }, - { - "key": "RichTextEditor::Read Only::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, - { - "key": "RichTextEditor::Required::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, - { - "key": "RichTextEditor::With Character Limit::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, - { - "key": "RichTextEditor::With Description::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, - { - "key": "RichTextEditor::With Initial Value::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, - { - "key": "RichTextEditor::With Toolbar::aria-input-field-name", - "impact": "serious", - "helpUrl": "https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=playwright" - }, { "key": "Schedule::Async Loader::color-contrast", "impact": "serious", diff --git a/apps/storybook/stories/RichTextEditor.stories.tsx b/apps/storybook/stories/RichTextEditor.stories.tsx index 9d65dca39b35..8948324fb4d0 100644 --- a/apps/storybook/stories/RichTextEditor.stories.tsx +++ b/apps/storybook/stories/RichTextEditor.stories.tsx @@ -72,7 +72,8 @@ export const WithCharacterLimit: Story = { args: { label: 'Bio', maxLength: 80, - description: 'A character counter appears below the editor when maxLength is set.', + description: + 'A character counter appears below the editor when maxLength is set.', placeholder: 'Type past 80 characters to see the counter turn red…', }, }; @@ -159,7 +160,7 @@ export const ControlledPersistence = {
RichTextView (read-only render of the same content)
- + ); @@ -190,7 +191,9 @@ export const ImperativeRef = { onClick={() => { const state = ref.current?.getEditorState(); const text = state?.read(() => $getRoot().getTextContent()); - setReadout(`getEditorState() text content: ${JSON.stringify(text)}`); + setReadout( + `getEditorState() text content: ${JSON.stringify(text)}`, + ); }}> getEditorState() @@ -277,12 +280,15 @@ export const MarkdownSerializers = { return (
-
+
+