[Android] Set AccessibilityNodeInfo.stateDescription so TalkBack stops reading "checked. on." on switches
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C++
- Star
- 127k
- Fork
- 25.3k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 4
Mô tả
Description
On Android, a view with accessibilityRole="switch" and accessibilityState={{ checked: true }} is read by TalkBack as "checked. on.". TalkBack takes "on" from the Switch class name and "checked" from isChecked. It suppresses the generic word only when stateDescription is set (API 30+).
ReactAccessibilityDelegate.kt on main never calls setStateDescription: for STATE_CHECKED it sets only isCheckable and isChecked. No JS prop reaches stateDescription, so apps can't fix this without native code.
A related request, #34736 ("Custom State Descriptions"), was closed by the stale bot in 2023 without a PR.
Steps to reproduce
- Render
<Pressable accessibilityRole="switch" accessibilityState={{ checked: true }} accessibilityLabel="Notifications" />. - Turn on TalkBack and focus the element.
- Hear "checked. on." in the announcement.
Expected
The state is read once ("on"), not twice.
Suggested fix
In ReactAccessibilityDelegate, when accessibilityState.checked is set, also call ViewCompat.setStateDescription (or AccessibilityNodeInfoCompat.setStateDescription). For role switch it would be "on"/"off", and for role checkbox "checked"/"not checked", using Android's own localized strings. Alternatively, expose accessibilityValue.text as the stateDescription.
Versions
- React Native 0.85.3 (Expo SDK 56). Also confirmed on
mainup to v0.88.0-rc.1 by reading the source. - TalkBack 17.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu trong ReactAccessibilityDelegate.kt, tại phần xử lý STATE_CHECKED, và lần theo cách accessibilityRole và accessibilityState đi đến node Android. So sánh hành vi được đề xuất của ViewCompat hoặc AccessibilityNodeInfoCompat đối với stateDescription cho các role switch và checkbox, sau đó xác minh rằng thông báo không còn lặp lại trạng thái trong khi hành vi accessibility hiện có vẫn được giữ nguyên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, kotlin, react-native
- Lĩnh vực
- accessibility, mobile
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 68/100