Calendar Accessibility: Prevent VoiceOver Calendar Scrollback #17761
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #17760
Description
Previously, when moving VoiceOver focus from the next button to the Date Cells on the Schedule Post popover, the calendar would scroll back to 1 Jan 1951.
This automated scrollback is a probably-intentional part of UICollectionView (to enable VoiceOver to read everything in a collection view) but it is not appropriate in its use here as a calendar.
This change prevents that automated scrollback, and only makes any change when the relevant accessibility features are in use.
The same issue happened sporadically on the year view calendar; I wasn't able to find repro steps for that, but this change should improve the behaviour there as well.
To test:
On the Schedule Post screen:
Screenshots
VoiceOver.calendar.scrollback.fixed.mp4
Regression Notes
General use of the calendar should be unaffected; the
UIAccessibility.isVoiceOverRunning
check which gates the changes will prevent issues when VoiceOver is not in use.Anywhere which scrolls the calendar automatically should be tested carefully. The Next/Previous Month buttons are examples of those, and other possibilities are layout changes, e.g. portrait/landscape, iPad size class changes.
Note that even without these changes, the calendar does not respond well to layout changes (the months stop fitting on the screen).
Also note, I do not have a physical iPad to test these changes on, so they have only been tested on a physical phone and an iPad simulator. To test on an iPad simulator, I had to change the condition in
CalendarCollectionView.shouldPreventAccessibilityFocusScrollback(for:)
to beif UIAccessibility.isVoiceOverRunning || UIDevice.isPad()
and use the Accessibility Inspector to move between elements, as the Inspector does not count as voiceover.The calendar is used both on the Activity Log date filter, and the Schedule Post date selector.
What I did to test those areas of impact (or what existing automated tests I relied on)
Extensive VoiceOver and Switch Control use of the calendar
What automated tests I added (or what prevented me from doing so)
None
PR submission checklist:
RELEASE-NOTES.txt
if necessary.