Conversation
WalkthroughThe PR adds Vercel project configuration files and comprehensive accessibility documentation for Slate editors. No functional code changes are introduced. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment Tip You can disable the changed files summary in the walkthrough.Disable the |
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
.vercel/README.txt.vercel/project.jsondocs/concepts/11-accessibility.md
| @@ -0,0 +1 @@ | |||
| {"projectId":"prj_V6ZPHv8clQQHNTKdgkfsFXlTrTAg","orgId":"team_2aCHvUVrYZucXr8M6nKbn8FC","projectName":"slate"} No newline at end of file | |||
There was a problem hiding this comment.
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.
| <label htmlFor={editorId}> | ||
| Biography | ||
| <span aria-label="required">*</span> | ||
| </label> | ||
| <Slate editor={editor} value={value} onChange={handleChange}> | ||
| <Editable | ||
| id={editorId} | ||
| aria-describedby={errorId} |
There was a problem hiding this comment.
🧩 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
fiRepository: 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=10Repository: 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 -20Repository: 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.
| <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.
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
Chores