Skip to content

Commit ddaa35c

Browse files
Hide SwipeActionsView from the accessibility tree (#616)
When a list item has swipe actions, the `DefaultSwipeActionButton` instances stayed in the accessibility tree even while the swipe was closed — the buttons were positioned off-screen, so VoiceOver ignores them under standard conditions but animations like rotation could still expose them momentarily allowing selection of "Void"/"Repeat"/"Delete" elements. `SwipeActionsView` now starts with `accessibilityElementsHidden = true` (matching its initial `.closed` state) and toggles in `apply(state:)`: hidden while `.closed`, exposed once the actions are open/swiping. The row's `accessibilityCustomActions` is unaffected, so VoiceOver can still trigger swipe actions via the Actions rotor without opening the swipe; once opened, the visible buttons are also reachable directly. ### Checklist Please do the following before merging: - [ ] Ensure any public-facing changes are reflected in the [changelog](https://github.com/square/Listable/blob/main/CHANGELOG.md). Include them in the `Main` section. --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2d64590 commit ddaa35c

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### Fixed
44

5+
- Hid swipe action buttons from VoiceOver while the swipe is closed. The buttons become accessibility elements again once the swipe is open, so the row's `accessibilityCustomActions` no longer competes with invisible, off-screen buttons.
6+
57
### Added
68

79
### Removed

ListableUI/Sources/Internal/SwipeActionsView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ final class SwipeActionsView: UIView {
6767
self.didPerformAction = didPerformAction
6868
super.init(frame: .zero)
6969
clipsToBounds = true
70+
accessibilityElementsHidden = true
7071

7172
addSubview(container)
7273
}
@@ -226,7 +227,9 @@ final class SwipeActionsView: UIView {
226227
func apply(state newState: SwipeActionState) {
227228
let priorState = state
228229
state = newState
229-
230+
231+
accessibilityElementsHidden = (newState == .closed)
232+
230233
guard newState.isRelevantFor(side: side) else {
231234
return
232235
}

0 commit comments

Comments
 (0)