Skip to content

fix(ui): retain custom mobile navigation headers - #600

Merged
houko merged 2 commits into
mainfrom
fix/navpage-custom-header
Nov 18, 2026
Merged

houko merged 2 commits into
mainfrom
fix/navpage-custom-header

Conversation

@houko

@houko houko commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

ui.NavPage discarded a page's custom Header on iOS and Android while preserving it on desktops. Keep it as the system navigation bar's title view, overriding HeaderTitle, while preserving the page's left/right views and system back behavior. A supplied NavHeader no longer replaces the custom page header; its scroll reference still drives iOS header blur.

Closes #556.

Behaviour

  • iOS and Android: a page's own Header becomes the system header's title view, in place of HeaderTitle, beside the page's HeaderLeft, HeaderRight and the system back button. Like every system header view it takes its content's size, so a header that only grows (a row with a stretching search field and no width) has no width there; the doc comment, the public navigation guide (English and Chinese) and the device differences table say so, and filling the bar's title area is recorded as a roadmap gap.
  • macOS, Windows, Linux and the web: unchanged, the page's own Header is drawn above the content.

Verification

  • TestNavPageKeepsCustomHeader fails on the iOS and Android environments without the fix (custom header mounted 0 times, want once) and passes on all six with it. It checks custom-header precedence, single mounting, natural size, retained native side views/back state and press handling.
  • go build ./..., go vet ./ui for windows/amd64, linux/amd64, android/arm64 and js/wasm, go tool nsgo check -target all, go tool nsgo test ./ui (185 passed) and go tool nsgo test -run 'Layer|Skills|Doc' . (35 passed).
  • ui/testdata/navheader checks on a native target that the custom header is the system title view and that its colored pixels are on screen.
  • go tool nsgo test -target ios_simulator ./ui/testdata/navheader passed on an iOS 27 simulator.
  • go tool nsgo test -target android ./ui/testdata/navheader passes on the Android API 35 emulator after the rebase onto current main, and fails there without the fix (the custom header is not the system title view). The Pixel 3 XL was not attached, so the run used the emulator; the iPhone itself could not be checked.

@github-actions github-actions Bot added size/S documentation Improvements or additions to documentation ui bug Something isn't working labels Nov 17, 2026
@houko
houko force-pushed the fix/navpage-custom-header branch 3 times, most recently from 68f1cfb to 11ad607 Compare November 18, 2026 02:14
…size

A page's own Header becomes the system header's title view on iOS and Android, which lays header views out at their content's size, so a header that only grows, such as a row with a stretching search field, has no width there while it spans the page on desktops. Say so in NavPage's doc, the public navigation guide (English and Chinese, which lacked the new paragraph) and the device differences table, whose NavPage row now names the platforms that differ, and record filling the bar as a roadmap gap.
@houko
houko force-pushed the fix/navpage-custom-header branch from 11ad607 to 293ead0 Compare November 18, 2026 02:16
@houko

houko commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed.

  • Diff read in full against main: the ui/navpage.go hunk routes a page's own Header to HeaderTitle on the system-header path only, keeps only NavHeader.Scroll/ScrollFunc, and systemNavPage still clears p.Header, so the view is mounted once (as the title view, not as the unused bar). Desktop and web paths are untouched. Docs (NavPage doc comment, English and Chinese navigation guides, device-differences row, roadmap gap) match the behaviour. No CHANGELOG change, no hard-wrapped lines, no attribution.
  • Rebased onto current main (a4bc57f); no conflicts.
  • ubuild (linux/amd64): go build ./... and go build + go vet ./ui ./ui/testdata/navheader for windows/amd64, linux/amd64, android/arm64 and js/wasm passed; go vet for darwin/arm64 passed; go tool nsgo check -target all passed (Apple targets skipped there); go tool nsgo test ./ui 185 passed; go tool nsgo test -run 'Layer|Skills|Doc' . 35 passed.
  • Regression check: with ui/navpage.go reverted to main, TestNavPageKeepsCustomHeader fails on ios and android ("custom header mounted 0 times, want once") and passes on macos, windows, linux and web.
  • Android, headless API 35 emulator: go tool nsgo test -target android ./ui/testdata/navheader passes (custom header is the toolbar's title view and its magenta pixels are on screen); with the fix reverted it fails ("the custom header is not the system title view"). The Pixel 3 XL was not attached, so no physical Android run.
  • iOS 27 simulator (iPhone 17 Pro, fresh device): the same fixture passes with the fix and fails without it with the same message. A physical iPhone could not be checked.

@houko
houko marked this pull request as ready for review November 18, 2026 02:16
@houko

houko commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed. The only CI failures are unrelated to this change: TestNestedZoomedCanvasIsSharp, fixed on main by #631, and the hosted runner's slow simulator boot, addressed by #634.

@houko
houko merged commit a760ebf into main Nov 18, 2026
25 of 29 checks passed
@houko
houko deleted the fix/navpage-custom-header branch November 18, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation size/S ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui.NavPage drops the page's own Header on iOS and Android

1 participant