Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix #8451: Defer toolbar state updates on viewWillAppear by 1 cycle #8452

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Sources/Brave/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1117,10 +1117,14 @@ public class BrowserViewController: UIViewController {
override public func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if #available(iOS 17, *) {
// On iOS 17 rotating the device with a full screen modal presented (e.g. Playlist, Tab Tray)
// to landscape then back to portrait does not trigger `traitCollectionDidChange`/`willTransition`/etc
// calls and so the toolbar remains in the wrong state.
updateToolbarStateForTraitCollection(traitCollection)
// Have to defer this to the next cycle to avoid an iOS bug which lays out the toolbars without any
// bottom safe area, resulting in a layout bug.
DispatchQueue.main.async {
// On iOS 17 rotating the device with a full screen modal presented (e.g. Playlist, Tab Tray)
// to landscape then back to portrait does not trigger `traitCollectionDidChange`/`willTransition`/etc
// calls and so the toolbar remains in the wrong state.
self.updateToolbarStateForTraitCollection(self.traitCollection)
}
}
updateToolbarUsingTabManager(tabManager)

Expand Down