-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bk/another accessibility refactor #297
Conversation
5fdc746
to
a63c3a1
Compare
@@ -25,6 +25,7 @@ final class ItemViewReuseManager { | |||
|
|||
func viewsForVisibleItems( | |||
_ visibleItems: Set<VisibleItem>, | |||
recycleOldViews: Bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something more descriptive?
recycleOldViews: Bool, | |
recycleOffscreenViews: Bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They might not be offscreen, so going with recycleUnusedViews
(imagine we just switch from using DayViewA
to DayViewB
for a visible day, it's not really offscreen in terms of being within the visible bounds of the scroll view)
Sources/Public/CalendarView.swift
Outdated
@@ -526,6 +520,14 @@ public final class CalendarView: UIView { | |||
private lazy var scrollViewDelegate = ScrollViewDelegate(calendarView: self) | |||
private lazy var gestureRecognizerDelegate = GestureRecognizerDelegate(calendarView: self) | |||
|
|||
private var hasHadInitialItemViewFocus = false { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private var hasHadInitialItemViewFocus = false { | |
private var initialItemViewWasFocused = false { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good trade off!
655641b
to
7fbe53d
Compare
7fbe53d
to
1c5e9ac
Compare
Details
This PR makes further accessibility improvements. The main thing here is that we no longer post
.layoutChanged
or.screenChanged
notifications to force focus, and instead rely on UIScrollView to handle maintaining element focus for us (which works well, as long as views aren't reused!).Speaking of that, this disables view recycling when voice over is active. This greatly simplifies things, and removes the need to constantly try to regain control over the focus. I should have thought of this sooner 🫠 We still have flat memory usage since off-screen views are simply deallocated. We pay a small CPU performance price, but Voice Over users won't be scrolling super fast anyways, so the tradeoff seems good. The overall UX for Voice Over users is significantly improved since focus never temporarily jumps around.
Related Issue
N/A
Motivation and Context
Improve VO UX
How Has This Been Tested
Types of changes
Checklist