Skip to content

Commit f07d04e

Browse files
Refactor FXIOS-12485 [Toolbar] Don't hide toolbars on scroll when voice over is enabled (backport #27218) (#27228)
Refactor FXIOS-12485 [Toolbar] Don't hide toolbars on scroll when voice over is enabled (#27218) Turn off hiding toolbars when voice over is turned on (cherry picked from commit 47c2a6c) Co-authored-by: Winnie Teichmann <[email protected]>
1 parent 0ab06af commit f07d04e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

firefox-ios/Client/Frontend/Browser/TabScrollController.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,13 @@ class TabScrollController: NSObject,
132132
return windowUUID
133133
}
134134

135-
// If scrollview contentSize height is bigger that device height plus delta
136-
// New settings to disable bar autohide only for iPad
137-
var isAbleToScroll: Bool {
138-
return (UIScreen.main.bounds.size.height + 2 * UIConstants.ToolbarHeight) <
135+
/// Returns true when the scrollview contentSize height is bigger than device height plus delta
136+
/// and voice over is turned off
137+
var shouldUpdateUIWhenScrolling: Bool {
138+
let heightNeedsScrolling = (UIScreen.main.bounds.size.height + 2 * UIConstants.ToolbarHeight) <
139139
contentSize.height
140+
let voiceOverOff = !UIAccessibility.isVoiceOverRunning
141+
return heightNeedsScrolling && voiceOverOff
140142
}
141143

142144
deinit {
@@ -208,7 +210,7 @@ class TabScrollController: NSObject,
208210
setScrollDirection(delta)
209211

210212
lastPanTranslation = translation.y
211-
if checkRubberbanding() && isAbleToScroll {
213+
if checkRubberbanding() && shouldUpdateUIWhenScrolling {
212214
scrollWithDelta(delta)
213215
updateToolbarState()
214216
}
@@ -290,7 +292,7 @@ class TabScrollController: NSObject,
290292
context: UnsafeMutableRawPointer?
291293
) {
292294
if keyPath == "contentSize" {
293-
guard isAbleToScroll, toolbarsShowing else { return }
295+
guard shouldUpdateUIWhenScrolling, toolbarsShowing else { return }
294296

295297
showToolbars(animated: true)
296298
}
@@ -611,7 +613,7 @@ extension TabScrollController: UIScrollViewDelegate {
611613
!tabIsLoading(),
612614
!scrollReachBottom(),
613615
!tab.isFindInPageMode,
614-
isAbleToScroll else { return }
616+
shouldUpdateUIWhenScrolling else { return }
615617

616618
tab.shouldScrollToTop = false
617619

0 commit comments

Comments
 (0)