Commit 2722198
feat: improve keyboard navigation and screen reader accessibility for… (aehrc#1767)
* feat: improve keyboard navigation and screen reader accessibility for choice dropdown fields
- Remove multiline prop from Choice Select fields to render as proper single-line combobox
- Add aria-labelledby to link field labels for proper VoiceOver announcement
- Use aria-label fallback for tabled fields without visible labels
This ensures VoiceOver announces the field name (e.g., 'Smoking status, combo box')
and enables standard keyboard navigation (Tab to focus, Arrow keys to navigate options,
Enter to select, Escape to close).
Fixes aehrc#1762
* fix: Update Choice test to query for input instead of textarea
After removing multiline prop from Select fields, the component now renders as <input> instead of <textarea>. Updated test to query for 'input' element to match the new rendering.
* feat: Add openOnFocus to enable keyboard-only dropdown access
Add openOnFocus prop to MUI Autocomplete components for Select choice fields.
This enables the dropdown to open automatically when the field receives Tab focus,
allowing full keyboard-only navigation without requiring mouse interaction.
- Tab to field → dropdown opens automatically
- Arrow keys → navigate options
- Enter → select option
- Escape → close dropdown
* feat: Add explicit role='combobox' for proper VoiceOver recognition
- Explicitly set role='combobox' on input element to ensure entire dropdown component (text input + arrow) is recognized as one unit
- Removes 'openOnFocus' to prevent automatic dropdown opening that interferes with VoiceOver field name announcement
- Maintains aria-labelledby for proper field name announcement
This ensures VoiceOver announces 'Smoking status, combo box' and provides proper keyboard navigation instructions to users.
Fixes aehrc#1762
* style: Fix prettier formatting in ChoiceSelectAnswerOptionFields
---------
Co-authored-by: Maryam Mehdizadeh <maryam.mehdizadeh@csiro.au>1 parent d491967 commit 2722198
3 files changed
Lines changed: 13 additions & 5 deletions
File tree
- packages/smart-forms-renderer/src
- components/FormComponents/ChoiceItems
- stories/itemTypes
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
| |||
93 | 92 | | |
94 | 93 | | |
95 | 94 | | |
96 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
97 | 103 | | |
98 | 104 | | |
99 | 105 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
| |||
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
106 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
0 commit comments