Keep the tab bar's minimize behaviour in sync with programmatic tab selection - #26011
Open
jkmassel wants to merge 1 commit into
Open
Keep the tab bar's minimize behaviour in sync with programmatic tab selection#26011jkmassel wants to merge 1 commit into
jkmassel wants to merge 1 commit into
Conversation
`tabBarMinimizeBehavior` was only updated from `tabBarController:shouldSelectViewController:`, which UIKit sends solely for taps on the tab bar. Every programmatic selection — deep links, push notifications, `reloadTabs`, the key commands — left the behavior set for whichever tab was tapped last. Drive it from the selection instead, by overriding `setSelectedIndex:` and `setSelectedViewController:`, and move the tap path onto the `didSelect` delegate so it reads a committed selection rather than a pending one.
Contributor
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 34439 | |
| Version | PR #26011 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 62be485 | |
| Installation URL | 1q2imagjub880 |
Contributor
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 34439 | |
| Version | PR #26011 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 62be485 | |
| Installation URL | 3k22do0vig1m0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Description
On iOS 26 the Reader tab is the only tab whose tab bar minimizes on scroll. That behaviour is applied per-selection — and it was only ever updated when the user tapped the tab bar. Any selection made in code left it set for whichever tab was tapped last.
Two ways that goes wrong:
.neverand no longer minimizes on scroll..onScrollDownand minimizes on a screen that should never minimize.trunkReader's Discover feed, reached by tapping My Site and then following
jpdebug:///discover— a selection made in code rather than a tap. Same post, same scroll position. Ontrunkthe tab bar stays expanded; with the fix it collapses to the pill, matching what already happens when Reader is reached by tapping.Root cause
WPTabBarController.mupdatedtabBarMinimizeBehaviorfromtabBarController:shouldSelectViewController:. UIKit sends that message only for taps on the tab bar itself, so every programmatic path bypassed it:showMySitesTab/showReaderTab/showNotificationsTab/showMeTabreloadTabs, which resets the selection to My SiteRootViewPresentershouldSelectViewController:also runs before the selection commits, so it read the incoming view controller whileselectedIndexstill pointed at the outgoing tab.Changes
WPTabBarController.m: overridesetSelectedIndex:andsetSelectedViewController:to update the behaviour after the selection lands, and move the tap path ontotabBarController:didSelectViewController:, which reads a committed selection.WPTabBarController+Swift.swift: replacedidSelectViewController(_:)withupdateTabBarMinimizeBehavior(), which reads the current selection rather than taking a view controller.The new method compares
selectedIndexagainstWPTab.readerinstead of comparing againstreaderNavigationController. That getter lazily builds the Reader presenter, and calling it fromsetSelectedIndex:would force the Reader stack into existence earlier than it is today. The two are equivalent —tabViewControllersbuilds inWPTaborder.Both the setter overrides and the delegate call the same update. It's idempotent, and keeping both means taps stay covered whether or not UIKit's internal tap handling routes through the public setter.
Testing instructions
Needs iOS 26 or later —
tabBarMinimizeBehaviordoes not exist before that.Verified on an iPhone 17 simulator running iOS 26.4, comparing a build of
trunkagainst this branch.The observable is the tab bar collapsing to its minimized pill. In the accessibility tree the four
tabbar_*buttons disappear when it collapses, which is what the counts below refer to.xcrun simctl openurl booted "jpdebug:///discover", then scroll the feed. Ontrunkthe bar stayed expanded (4 buttons before and after). On this branch it collapses (4 → 0). The feed scrolled in both runs — a tracked row moved fromy=231.0toy=-106.0andy=-76.0respectively — so the stationary bar ontrunkis not a missed gesture.For a reviewer:
xcrun simctl openurl booted "jpdebug:///discover"and accept the "Open in Jetpack?" prompt, then scroll the Discover feed — the tab bar shrinks to a pill showing only the Reader icon.Related issues
Investigated from #26004, where the tab bar renders with staggered label baselines and a truncated "Rea…" on My Site after the app has been backgrounded. A tab bar carrying the wrong minimize behaviour for its tab is a plausible cause of that state, and #26004's screenshot shows My Site selected with the dashboard scrolled — which is the configuration this PR fixes.
That link is unproven. This PR is not marked as closing #26004; the stale behaviour is a defect on its own terms, and the visual symptom in that report was not reproduced.