Skip to content

Keep the tab bar's minimize behaviour in sync with programmatic tab selection - #26011

Open
jkmassel wants to merge 1 commit into
trunkfrom
jkmassel/issue-26004-comment
Open

Keep the tab bar's minimize behaviour in sync with programmatic tab selection#26011
jkmassel wants to merge 1 commit into
trunkfrom
jkmassel/issue-26004-comment

Conversation

@jkmassel

@jkmassel jkmassel commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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:

  • Tap My Site, then follow a deep link or push notification into Reader — Reader keeps .never and no longer minimizes on scroll.
  • Visit Reader, then get moved to another tab in code — that tab keeps .onScrollDown and minimizes on a screen that should never minimize.
Before — trunk After — this PR
Reader feed on trunk, tab bar still fully expanded over the content Reader feed with the fix, tab bar collapsed to the Reader pill

Reader'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. On trunk the 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.m updated tabBarMinimizeBehavior from tabBarController:shouldSelectViewController:. UIKit sends that message only for taps on the tab bar itself, so every programmatic path bypassed it:

  • showMySitesTab / showReaderTab / showNotificationsTab / showMeTab
  • reloadTabs, which resets the selection to My Site
  • deep links, push notification taps, widget and 3D Touch routing through RootViewPresenter
  • the ⌘1/⌘2/⌘4 key commands

shouldSelectViewController: also runs before the selection commits, so it read the incoming view controller while selectedIndex still pointed at the outgoing tab.

Changes

WPTabBarController.m: override setSelectedIndex: and setSelectedViewController: to update the behaviour after the selection lands, and move the tap path onto tabBarController:didSelectViewController:, which reads a committed selection.

WPTabBarController+Swift.swift: replace didSelectViewController(_:) with updateTabBarMinimizeBehavior(), which reads the current selection rather than taking a view controller.

The new method compares selectedIndex against WPTab.reader instead of comparing against readerNavigationController. That getter lazily builds the Reader presenter, and calling it from setSelectedIndex: would force the Reader stack into existence earlier than it is today. The two are equivalent — tabViewControllers builds in WPTab order.

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 — tabBarMinimizeBehavior does not exist before that.

Verified on an iPhone 17 simulator running iOS 26.4, comparing a build of trunk against 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.

  • Reader reached programmatically now minimizes on scroll. Tap My Site, then xcrun simctl openurl booted "jpdebug:///discover", then scroll the feed. On trunk the 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 from y=231.0 to y=-106.0 and y=-76.0 respectively — so the stationary bar on trunk is not a missed gesture.
  • Reaching Reader by tapping still minimizes on scroll (4 → 0).
  • My Site still does not minimize on scroll (4 → 4).

For a reviewer:

  • Tap My Site, run 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.
  • Tap Reader directly and scroll — the bar shrinks the same way.
  • Tap My Site and scroll the dashboard to the bottom — the bar stays full width with all four tabs visible.

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.

`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.
@jkmassel jkmassel added [Type] Bug Reader UI User interface bugs labels Sep 9, 2026
@jkmassel jkmassel self-assigned this Sep 9, 2026
@jkmassel jkmassel added this to the 27.3 milestone Sep 9, 2026
@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number34439
VersionPR #26011
Bundle IDorg.wordpress.alpha
Commit62be485
Installation URL1q2imagjub880
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number34439
VersionPR #26011
Bundle IDcom.jetpack.alpha
Commit62be485
Installation URL3k22do0vig1m0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reader [Type] Bug UI User interface bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants