docs: Reformat TextArea Accessibility - #4058
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Workday/canvas-kit
|
||||||||||||||||||||||||||||||||||||||||
| Project |
Workday/canvas-kit
|
| Branch Review |
text-area-reformat
|
| Run status |
|
| Run duration | 02m 27s |
| Commit |
|
| Committer | moaan-workday |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
17
|
|
|
0
|
|
|
809
|
| View all changes introduced in this branch ↗︎ | |
UI Coverage
19.52%
|
|
|---|---|
|
|
1540
|
|
|
371
|
Accessibility
99.44%
|
|
|---|---|
|
|
5 critical
5 serious
0 moderate
2 minor
|
|
|
68
|
Co-authored-by: Cursor <cursoragent@cursor.com>
williamjstanton
left a comment
There was a problem hiding this comment.
Putting in some feedback of my own to help move this along. I think we have a couple of big questions to work through:
- Should we be focusing on React TSX code, or DOM renders for AI code-gen? What's more deterministic?
- How do we avoid duplicating docs? How are we splitting concerns between what TextArea does and what FormField is doing?
| ```html | ||
| <div> | ||
| <label id="label-abc" for="input-abc">Leave a Review</label> | ||
| <textarea id="input-abc" aria-labelledby="label-abc"></textarea> |
There was a problem hiding this comment.
DOM example contradicts your own implementation note
You document that FormField.Input always sets aria-describedby="hint-{id}", but the first HTML sample has no aria-describedby. Dialog never shows a simplified DOM that contradicts built-ins. For codegen, that first snippet will win over the prose. Either show the always-on attribute (and a missing #hint-abc as the bug case), or drop the “simple” example.
There was a problem hiding this comment.
Attempted fix in commit:
docs(text-area): Show aria-describedby in simple DOM example without hint
26fc83469
| - Help text and error messages (via `aria-describedby`). | ||
| - The current value or "blank" if empty. | ||
| - That it's a multi-line text input field. | ||
| | Requirement | How to satisfy | |
There was a problem hiding this comment.
Too much FormField, not enough TextArea
Dialog points at FormField for labeled inputs in one row; it doesn’t re-spec FormField’s whole table. Your requirements table (label, hint, error, caution, required, stable IDs) largely duplicates FormField Accessibility. Dialog’s benchmark is: own what’s unique, link what’s shared. TextArea-unique rows should dominate: multi-line choice, resize, native <textarea> semantics, etc.
There was a problem hiding this comment.
I agree. I would recommend keeping Input wiring with a reference link to form field docs, character limit as those are the only ones specific to text area.
There was a problem hiding this comment.
Attempted a fix in following commit. How does it look now?
docs(text-area): Remove excessive formfield mention in the accessibility requirement and how to satisfy table
| - Set **`error`** on **`FormField`**, not on `TextArea` directly, so `aria-invalid` and error | ||
| styling stay in sync. | ||
|
|
||
| **Keyboard** (_standard multi-line text control behavior_): |
There was a problem hiding this comment.
Most of your keyboard bullets are native <textarea> / behavior. Keep a short “native multi-line control” note; spend the budget on anything Canvas Kit changes.
I'm concerned we might be using up too much context re-iterating native behaviors?
| - **User-resizable dimensions**: Defaults to `resize: both` so users can adjust the control for | ||
| visual comfort. | ||
|
|
||
| **Implementation notes**: |
There was a problem hiding this comment.
I don't think I've seen this implementation notes section before in our other drafts.
All of the bullet points either duplicate what's in FormField, or duplicate anti-patterns below.
IMO, we should consider removing this set of bullets altogether.
| | Character limit _(conditional)_ | `maxLength` on **`FormField.Input`**, visible count in **`FormField.Hint`**, and debounced **`AriaLiveRegion`** for screen reader updates | | ||
| | Placeholder _(conditional)_ | Short format example on **`FormField.Input`** only—never as the sole label | | ||
| | Stable IDs _(conditional)_ | `id` prop on **`FormField`** when predictable `label-`, `input-`, and `hint-` IDs are needed for testing | | ||
| | Resize constraints _(conditional)_ | `resize` prop on **`TextArea`**; default to `Both` unless layout requires otherwise | |
There was a problem hiding this comment.
Referring to my other comment, I think we should remove this since it is just a CSS property.
| | Disabled field _(conditional)_ | `disabled` on **`FormField.Input`** (passed through to `<textarea>`) | | ||
| | Character limit _(conditional)_ | `maxLength` on **`FormField.Input`**, visible count in **`FormField.Hint`**, and debounced **`AriaLiveRegion`** for screen reader updates | | ||
| | Placeholder _(conditional)_ | Short format example on **`FormField.Input`** only—never as the sole label | | ||
| | Stable IDs _(conditional)_ | `id` prop on **`FormField`** when predictable `label-`, `input-`, and `hint-` IDs are needed for testing | |
There was a problem hiding this comment.
I don't understand why stable ID's are listed here as conditional requirements. IMO, I think we should remove.
| - Help text and error messages (via `aria-describedby`). | ||
| - The current value or "blank" if empty. | ||
| - That it's a multi-line text input field. | ||
| | Requirement | How to satisfy | |
There was a problem hiding this comment.
I agree. I would recommend keeping Input wiring with a reference link to form field docs, character limit as those are the only ones specific to text area.
| - **CONDITIONAL:** hint/error text, required state, disabled state, character limit with live | ||
| region, placeholder, stable `id`, resize constraints | ||
|
|
||
| ### Anti-Patterns |
There was a problem hiding this comment.
Let's trim this section down as well. Only keep the ones that are unique to Text area: Single-line input for multi-line content, Per-keystroke character announcements and Disabling resize unnecessarily. Add a reference to the Anti-patterns section for Form Field to avoid duplicating content.
…ity requirement and how to satisfy table
Summary
This PR rewrites the
TextAreaStorybook accessibility section to match the newer AI-codegen documentation template (the same pattern used forDialogandFormField). It turns a short paragraph into a comprehensive accessibility guide.label-{id},input-{id},hint-{id}.FormField.Inputwiresaria-labelledby,aria-describedby,aria-invalid, andrequiredautomatically.error="caution"is visual-only and does not setaria-invalid.FormField.Inputalways setsaria-describedby="hint-{id}"when anidexists, so omittingFormField.Hintcreates a dangling reference.AriaLiveRegionexample for character counts and links to the existing guide.Release Category
Documentation
Checklist
ready for reviewhas been added to PRFor the Reviewer
Where Should the Reviewer Start?
Areas for Feedback? (optional)
Testing Manually
Screenshots or GIFs (if applicable)
Thank You Gif (optional)