Skip to content

Accessibility documentation#4

Open
ssawczyn wants to merge 2 commits intoteam-reflect:mainfrom
ssawczyn:ssawczyn/accessibility-documentation
Open

Accessibility documentation#4
ssawczyn wants to merge 2 commits intoteam-reflect:mainfrom
ssawczyn:ssawczyn/accessibility-documentation

Conversation

@ssawczyn
Copy link

@ssawczyn ssawczyn commented Mar 13, 2026

I've added a document detailing accessibility best practices, including roles needed for auto-complete, in docs/concepts in the hopes that it might be used to improve Slate as implemented in Reflect. I'm trying to make some of these changes myself, however testing is proving a bit tricky, so thought I would submit just the documentation for now.

Summary by CodeRabbit

  • Documentation

    • Added comprehensive accessibility guide for Slate editors, covering ARIA attributes, keyboard navigation, semantic HTML, focus management, live regions, toolbar accessibility, testing approaches, common pitfalls, autocomplete and mentions patterns, and WCAG 2.2 AA compliance mappings.
  • Chores

    • Added Vercel project configuration files.

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Walkthrough

The PR adds Vercel project configuration files and comprehensive accessibility documentation for Slate editors. No functional code changes are introduced.

Changes

Cohort / File(s) Summary
Vercel Configuration
.vercel/README.txt, .vercel/project.json
New files documenting the .vercel folder structure and Vercel project configuration (projectId, orgId, projectName). README advises not committing the folder.
Accessibility Documentation
docs/concepts/11-accessibility.md
New comprehensive guide covering Slate editor accessibility practices, including ARIA attributes, keyboard navigation, semantic HTML, focus management, testing strategies, WCAG 2.2 AA compliance, and accessible component patterns with code examples.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Accessibility documentation' is vague and generic, using non-descriptive terms that don't clearly convey what specific accessibility documentation is being added. Consider a more specific title that describes the main content, such as 'Add accessibility best practices documentation for Slate editors' or 'Document accessibility patterns and ARIA guidelines for Slate'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable the changed files summary in the walkthrough.

Disable the reviews.changed_files_summary setting to disable the changed files summary in the walkthrough.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
docs/concepts/11-accessibility.md (1)

495-495: Tighten repeated wording in this bullet.

“properly” appears twice in close succession; consider rephrasing for readability.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/concepts/11-accessibility.md` at line 495, The bullet "- ❌ Keyboard
focus won't be properly managed" repeats "properly" near other text—update this
line to a tighter phrasing (e.g., "Keyboard focus won't be managed correctly" or
"Keyboard focus may be lost") to remove the duplicated adverb and improve
readability; locate and edit the exact bullet text in
docs/concepts/11-accessibility.md to apply the new wording.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.vercel/project.json:
- Line 1: Remove the committed Vercel linkage metadata by untracking
.vercel/project.json (and optionally .vercel/README.txt) from git and prevent
future commits by adding .vercel/ to .gitignore; specifically, locate the
.vercel/project.json entry, remove that file from the repository index (untrack
it) and commit the removal, add a line with ".vercel/" to .gitignore, and commit
the .gitignore change so the project/org identifiers are no longer tracked.

In `@docs/concepts/11-accessibility.md`:
- Around line 118-125: The example uses a <label htmlFor={editorId}> with
Slate's <Editable> which is a contenteditable region and won't be associated via
htmlFor; change the example to keep the visible <label> but switch the Editable
to reference the label using aria-labelledby={editorLabelId} (create a unique
editorLabelId for the <label> using the same id value), remove or stop using
htmlFor/htmlFor association for <Editable>, and keep aria-describedby={errorId}
on <Editable> so validation is preserved; update any related identifiers
(editorId vs editorLabelId) in the Slate/Editable usage (and in
handleChange/value/editor context) to reflect the new aria-labelledby
relationship.

---

Nitpick comments:
In `@docs/concepts/11-accessibility.md`:
- Line 495: The bullet "- ❌ Keyboard focus won't be properly managed" repeats
"properly" near other text—update this line to a tighter phrasing (e.g.,
"Keyboard focus won't be managed correctly" or "Keyboard focus may be lost") to
remove the duplicated adverb and improve readability; locate and edit the exact
bullet text in docs/concepts/11-accessibility.md to apply the new wording.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7056932d-6f65-4d64-9b37-e754664ec359

📥 Commits

Reviewing files that changed from the base of the PR and between 7079d0c and eb514ff.

📒 Files selected for processing (3)
  • .vercel/README.txt
  • .vercel/project.json
  • docs/concepts/11-accessibility.md

@@ -0,0 +1 @@
{"projectId":"prj_V6ZPHv8clQQHNTKdgkfsFXlTrTAg","orgId":"team_2aCHvUVrYZucXr8M6nKbn8FC","projectName":"slate"} No newline at end of file
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove committed Vercel linkage metadata from source control.

This file should not be tracked in git; it exposes project/org identifiers and conflicts with the guidance in .vercel/README.txt (Lines 9-11). Remove .vercel/project.json from the repo and add .vercel/ to .gitignore to prevent re-commit.

Suggested remediation
# .gitignore
+.vercel/
# one-time cleanup
git rm --cached .vercel/project.json .vercel/README.txt
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.vercel/project.json at line 1, Remove the committed Vercel linkage metadata
by untracking .vercel/project.json (and optionally .vercel/README.txt) from git
and prevent future commits by adding .vercel/ to .gitignore; specifically,
locate the .vercel/project.json entry, remove that file from the repository
index (untrack it) and commit the removal, add a line with ".vercel/" to
.gitignore, and commit the .gitignore change so the project/org identifiers are
no longer tracked.

Comment on lines +118 to +125
<label htmlFor={editorId}>
Biography
<span aria-label="required">*</span>
</label>
<Slate editor={editor} value={value} onChange={handleChange}>
<Editable
id={editorId}
aria-describedby={errorId}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Does HTML <label for="..."> programmatically label a contenteditable <div>, and what is the recommended labeling pattern for custom editable widgets (e.g., role="textbox")?

💡 Result:

No. An HTML <label for="..."> only creates a programmatic label relationship if the referenced element is a labelable form control (e.g., input, textarea, select, etc.). A plain <div contenteditable> is not labelable, so the <label for> association does not apply. [1]

Recommended labeling pattern for custom editable widgets (e.g., role="textbox")

Use an ARIA accessible-name mechanism on the editable element:

Preferred when there’s a visible label (most common):

<div id="name-label">Name</div>
<div
  role="textbox"
  contenteditable="true"
  aria-labelledby="name-label">
</div>

This is the typical pattern for labeling custom widgets, analogous to what <label for> does for native controls. [2][3]

If there’s no visible label:

<div role="textbox" contenteditable="true" aria-label="Name"></div>

Use aria-label only when you can’t provide a visible labeling element. [4]

Important behavioral note: unlike native <label for>, aria-labelledby does not automatically make clicking the label move focus to the widget; if you want that behavior, add it with JavaScript. [3]

Also: if you can, prefer a native <input>/<textarea> over role="textbox" + contenteditable for better built-in accessibility and behavior. [2]

Sources: [1] [2] [3] [4]


🏁 Script executed:

# Check if the file exists and read the relevant section
if [ -f "docs/concepts/11-accessibility.md" ]; then
  echo "=== File exists, reading lines 110-130 for context ==="
  sed -n '110,130p' "docs/concepts/11-accessibility.md"
else
  echo "File not found at docs/concepts/11-accessibility.md"
  echo "Searching for accessibility-related markdown files..."
  find . -name "*accessibility*" -type f
fi

Repository: team-reflect/slate

Length of output: 654


🏁 Script executed:

# Search for information about Slate's Editable component
rg -i "slate.*editable|editable.*contenteditable" --max-count=10

Repository: team-reflect/slate

Length of output: 3206


🏁 Script executed:

# Check if there's any Slate documentation or configuration in the repo
fd -i "slate" -t f | head -20

Repository: team-reflect/slate

Length of output: 343


Use aria-labelledby instead of <label htmlFor> for <Editable> examples.

The <label htmlFor> attribute only creates a programmatic label relationship with labelable form controls (e.g., input, textarea, select). Slate's <Editable> component is a contenteditable region and does not support this association, making this example misleading. Use aria-labelledby on <Editable> to provide the accessible label:

Suggested doc correction
-      <label htmlFor={editorId}>
+      <div id="bio-label">
         Biography
         <span aria-label="required">*</span>
-      </label>
+      </div>
       <Slate editor={editor} value={value} onChange={handleChange}>
         <Editable
           id={editorId}
+          aria-labelledby="bio-label"
           aria-describedby={errorId}
           aria-invalid={!!error}
           placeholder="Tell us about yourself..."
         />
       </Slate>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<label htmlFor={editorId}>
Biography
<span aria-label="required">*</span>
</label>
<Slate editor={editor} value={value} onChange={handleChange}>
<Editable
id={editorId}
aria-describedby={errorId}
<div id="bio-label">
Biography
<span aria-label="required">*</span>
</div>
<Slate editor={editor} value={value} onChange={handleChange}>
<Editable
id={editorId}
aria-labelledby="bio-label"
aria-describedby={errorId}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/concepts/11-accessibility.md` around lines 118 - 125, The example uses a
<label htmlFor={editorId}> with Slate's <Editable> which is a contenteditable
region and won't be associated via htmlFor; change the example to keep the
visible <label> but switch the Editable to reference the label using
aria-labelledby={editorLabelId} (create a unique editorLabelId for the <label>
using the same id value), remove or stop using htmlFor/htmlFor association for
<Editable>, and keep aria-describedby={errorId} on <Editable> so validation is
preserved; update any related identifiers (editorId vs editorLabelId) in the
Slate/Editable usage (and in handleChange/value/editor context) to reflect the
new aria-labelledby relationship.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant