Skip to content

docs(tabbar): put the TabBar in the iOS vertical bar - #1704

Merged
ajpinedam merged 6 commits into
mainfrom
dev/anpi/tabbar-ios-vertical-bar
Nov 24, 2026
Merged

ajpinedam merged 6 commits into
mainfrom
dev/anpi/tabbar-ios-vertical-bar

Conversation

@ajpinedam

@ajpinedam ajpinedam commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue (If applicable): N/A, tracked internally (see below)

PR Type

What kind of change does this PR introduce?

  • Documentation content changes
  • Other: a new sample page in the Toolkit sample app

What is the current behavior?

On iOS 27.1, the iPhone Duo cover screen shows a vertical bar: an 84 pt strip that holds the status bar, on the right in portrait and on the left in landscape. Native tab bars move into it as an icon-only vertical bar.

iOS reports the strip as a left or right safe-area inset, and the window width doesn't change. The documented responsive TabBar recipe picks a layout from the width, so it keeps the bottom TabBar in both orientations. SafeArea keeps the items out of the strip, but the strip stays empty. The docs don't say how to use the strip.

What is the new behavior?

  • New how-to section, "Put the TabBar in the iOS vertical bar", in doc/controls/walkthroughs/TabBar-and-TabBarItem.howto.md:
    • Reads UITraitCollection.VerticalBarEdge and shows an icon-only vertical TabBar in the strip, sized from SafeArea.WindowInsets.
    • Binds the vertical TabBar's SelectedIndex to the bottom TabBar's.
    • Updates on ApplicationView.VisibleBoundsChanged, which covers the strip appearing after launch, and on XamlRoot.Changed, which covers rotation (on iOS, Uno raises VisibleBoundsChanged before it updates the window size).
    • Notes cover the iOS 27.1 SDK requirement, NavigationBar insets, {utu:Responsive} and FlowDirection.
    • FAQ entry: "Why is there an empty strip next to my TabBar on the iPhone Duo?"
    • Screenshots from the iPhone Duo cover screen: the existing bottom TabBar sample with the strip left empty, and the new sample in portrait and landscape (doc/assets/tabbar-ios-vertical-bar-*.png).
  • doc/controls/TabBarAndTabBarItem.md links to the section from "Responsive TabBar Layout".
  • New sample M3MaterialIOSVerticalBarSampleNestedPage, opened from the "Show iOS Vertical Bar Sample" button on the Material TabBar sample page. It runs the doc code as a full page.
  • specs/tabbar-ios-vertical-bar/progress.md records the measurements, the plan and the validation.

The iOS code is guarded by IOS27_1_OR_GREATER, which is defined only when building with the iOS 27.1 bindings. CI builds with Xcode 26.1.1, so it compiles out there.

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Validation, on the iPhone Duo simulator (Xcode 27.1, iOS 27.1), cover screen:

  • Doc code: pasted unchanged into a fresh dotnet new unoapp (Uno.Sdk 7.1, Toolkit 11.0.1, Material, Skia renderer). Builds with no warnings against the iOS 27.1 bindings. The TabBar sits in the right strip in portrait and the left strip in landscape, selection stays in sync, and the strip appearing after launch is picked up. Rotating landscape → portrait, which the first round missed, is checked too. An iPhone 18 Pro on iOS 27.0 keeps the bottom TabBar.
  • Sample: the Material sample head builds for net10.0-desktop (code compiled out) and for net10.0-ios with the 27.1 bindings (code compiled in). It ran on the Duo through a temporary launch hook that isn't part of this PR, and matches the doc. The NavigationBar with Left,Top,Right insets stays out of the strip.

Found along the way:

  • OperatingSystem.IsIOSVersionAtLeast(27, 1) raises CA1416 on VerticalBarEdge, because the analyzer also treats it as a Mac Catalyst check. The doc and the sample use OperatingSystem.IsOSPlatformVersionAtLeast("ios", 27, 1), which builds clean.

Not covered:

  • cspell and markdownlint weren't run locally (no Node); I checked the main rules by hand, so CI will be the first real run.
  • The inner (unfolded) screen and a regular iPhone on iOS 27.1 are untested. The simulator can't be folded from the command line, and the 27.1 simulator runtime only accepts the iPhone Duo.
  • Apps can't opt out of the vertical bar today: that needs Uno's RootViewController to override PreferredVerticalBarBehavior.

Internal Issue (If applicable): https://github.com/unoplatform/uno-private/issues/2714

@ajpinedam ajpinedam self-assigned this Nov 19, 2026
@mergify

mergify Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@Xiaoy312 Xiaoy312 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving: docs and sample only, and the iOS code compiles out in CI. Findings from review, none blocking:

  1. Stale insets (M3MaterialIOSVerticalBarSampleNestedPage.xaml.cs, OnVisibleBoundsChanged): placement reads SafeArea.WindowInsets inside VisibleBoundsChanged, and SafeArea may not have updated yet. On rotation or at the launch transition the strip can end up on the wrong edge or the wrong bar can stay visible.
  2. Wrong scene (HasVerticalBar()): it uses the first connected UIWindowScene rather than the one hosting the page, which is wrong in multi-window setups.
  3. Left/right guessing (how-to snippet): the strip side comes from comparing insets, not from VerticalBarEdge (Leading/Trailing). It breaks under RTL, or when both insets are non-zero.
  4. Magic number: the fixed Height="240" on the vertical TabBar only fits exactly four items, and it is duplicated in the sample.
  5. GetForCurrentView() in Loaded/Unloaded: this is a legacy per-view API, so unsubscribing can fail or hit a different instance. Capturing the instance in a field would be safer.
  6. Test coverage: all logic is behind IOS27_1_OR_GREATER, which CI (Xcode 26.1.1) never defines, so it is never compiled there. No runtime tests are added, and the doc and sample XAML/code are duplicated verbatim.
  7. Validation notes (specs/tabbar-ios-vertical-bar/progress.md): the Duo simulator run used a temporary, uncommitted launch hook, so the shipped navigation path (button to nested page) isn't shown as exercised. The inner screen and a regular iPhone on 27.1 are untested.

@ajpinedam

Copy link
Copy Markdown
Contributor Author

@Xiaoy312 thanks for the review. I checked each point. One was a real bug, now fixed in 3bebf88 (doc) and 8f883a1 (sample).

  1. Stale insets: a real bug, with a slightly different cause. SafeArea.WindowInsets is computed on each read, but on iOS Uno raises VisibleBoundsChanged before it updates Window.Bounds (NativeWindowWrapperBase.SetBoundsAndVisibleBounds, same on master). Rotating landscape → portrait gave R=296 and a 296 pt panel over the content. My first run only rotated portrait → landscape, where the stale bounds still happen to give L=84. The recipe now also updates on XamlRoot.Changed, which Uno raises after the size update. I re-ran the doc code (in a fresh app) and the sample on the iPhone Duo simulator: launch, landscape, and landscape → portrait are all correct.
  2. Wrong scene: agreed in principle. ConnectedScenes is unordered, and Uno on iOS can run several windows when the app opts into multiple scenes. The lookup now picks a foreground scene. A fully per-window version would also need per-window insets, because SafeArea.WindowInsets and GetForCurrentView() both use the main window, so I left that out of the recipe.
  3. Left/right from the insets: kept. Logging showed that VerticalBarEdge still holds the pre-rotation value in these handlers (Trailing in landscape, Leading back in portrait), so using it would put the bar on the wrong side. The insets give the physical edge. The doc now explains this. The right-to-left limitation was already in the notes.
  4. Height="240": kept. The notes give the size per item, and the sample repeats the doc code on purpose.
  5. GetForCurrentView(): in Uno it always returns the main window's instance (GetOrCreateForWindowId(AppWindow.MainWindowId)), and SafeArea uses it the same way, so subscribing and unsubscribing hit the same object. The new code keeps the instance in a field anyway, next to the XamlRoot.
  6. Test coverage: agreed. There's nothing to add until CI builds with Xcode 27.1, and a runtime test would also need the Duo simulator. The sample duplicates the doc on purpose, so the doc code is compiled and runnable in the repo.
  7. Validation notes: fair. The hook made the same ShowNestedSample<…>(clearStack: true) call as the button, so only the button wiring was skipped, and the XAML compiler checks that the handler exists. The real gap was the rotation direction, which is now covered and recorded in progress.md.

@ajpinedam
ajpinedam merged commit b94d762 into main Nov 24, 2026
27 of 28 checks passed
@ajpinedam
ajpinedam deleted the dev/anpi/tabbar-ios-vertical-bar branch November 24, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants