Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2024-04-29 - Improve Accessible Controls for Password and Notepad screens
**Learning:** Icon-only buttons or those with disabled states must have clear accessibility attributes to remain understandable by screen readers and usable without a pointer. Adding disabled prop to disabled icon button, adding accessibilityState, and adding accessibilityRole improves accessibility significantly.
**Action:** Always wrap interactive icon elements in a standard TouchableOpacity that specifies accessible, accessibilityRole="button", accessibilityLabel, and hitSlop for a larger tap target. If it's disabled, set the accessibilityState appropriately.
13 changes: 12 additions & 1 deletion src/screens/NotepadScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,23 @@ export default function NotepadScreen() {
<Text style={s.title}>{t('notepadTitle')}</Text>
</View>
<View style={s.actions}>
<TouchableOpacity onPress={clear} style={s.iconBtn}>
<TouchableOpacity
onPress={clear}
style={s.iconBtn}
accessible={true}
accessibilityRole="button"
accessibilityLabel={t('notepadClearTitle')}
hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
>
<MaterialIcons name="delete-outline" size={22} color="#EF4444" />
</TouchableOpacity>
<TouchableOpacity
onPress={save}
style={[s.saveBtn, saved && s.saveBtnDim]}
disabled={saved}
accessible={true}
accessibilityRole="button"
accessibilityState={{ disabled: saved }}
>
<MaterialIcons name="save" size={18} color="#fff" />
<Text style={s.saveTxt}>{saved ? t('notepadSaved') : t('notepadSave')}</Text>
Expand Down
9 changes: 8 additions & 1 deletion src/screens/PasswordScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,14 @@ function PasswordRowComponent({ item, onEdit, onDelete }: { item: PasswordEntry;
{item.username ? <Text style={s.username}>{item.username}</Text> : null}
<View style={s.pwRow}>
<Text style={s.pw}>{revealed ? item.password : 'β€’β€’β€’β€’β€’β€’β€’β€’'}</Text>
<TouchableOpacity onPress={() => setRevealed(r => !r)} style={s.eyeBtn}>
<TouchableOpacity
onPress={() => setRevealed(r => !r)}
style={s.eyeBtn}
accessible={true}
accessibilityRole="button"
accessibilityLabel={revealed ? 'Nascondi password' : 'Mostra password'}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use localized labels for visibility toggle

This change hard-codes Italian accessibilityLabel values for the password reveal button, so in non-Italian locales (e.g., English) screen readers will announce the control in the wrong language. Since this screen already participates in app localization, the new labels should be sourced from translations to avoid regressing accessibility for users who rely on VoiceOver/TalkBack outside Italian.

Useful? React with πŸ‘Β / πŸ‘Ž.

hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
>
<MaterialIcons name={revealed ? 'visibility-off' : 'visibility'} size={16} color={colors.textSub} />
</TouchableOpacity>
</View>
Expand Down
Loading