Skip to content

iOS: a header's drawn bar items keep the old colour scheme until the next batch #667

Closed

Description

@janicduplessis

What happened

On iOS, a header button whose face is drawn (a label in the author's font-family, a status dot beside a label, a badge) becomes a bar item whose image is painted for one colour scheme. When the system appearance changes while the route is showing, and the app sends no batch in response, the item keeps the old image. A title written color="light-dark(#000000, #ffffff)" stays black on the dark glass until the bar is projected again, on a relaunch or a navigation.

Apps whose views read prefers-color-scheme happen to send a batch on the change, which hides the bug.

Related but different: #593 (a drawn face's padding) and #84 (a sheet's appearance before the next batch).

Cause

The bar item's image comes from ChipFace or BadgeFace, and dark is part of the face's source. The bar is projected again only from prepareRoutes, which runs after a batch. ExactView.reportScheme hears every scheme change, but it only reports the scheme to the session, tellPreferences() and natives.scopesChanged(). Nothing re-projects the bars.

How a fork fixed it

appandflow/exact#2 (open on the fork):

  • ExactView.reportScheme also calls session.presenter.navigation.schemeChanged().
  • NavigationHost.schemeChanged() runs prepareRoutes on each of allNavigations on the next main-queue turn, the same entry point scrollBackendChanged and replayHatches use. The face's source includes the scheme, so only routes whose faces changed are projected again, and kept items are changed in place.
  • One turn later. When the change is heard, the header's node views still report the old scheme (drawsDark reads their traitCollection), so projecting right away would rebuild an identical source and change nothing. Logging on the simulator showed the header node reporting light at that moment and dark a turn later.
  • Live stacks only. A stack whose routes are not all in controllers (one still showing a route after end(c), such as a sheet animating away) is skipped, so no route is hatched again after .ended.

The test NavigationBarIOSTests.testADrawnBarItemIsDrawnAgainWhenTheSchemeChanges boots the fixture below, flips the window's overrideUserInterfaceStyle, and reads the bar item's pixels. It fails without the fix. With the fix, all 47 NavigationBarIOSTests pass on an iPhone 18 Pro simulator (iOS 27.0).

Host

iOS

Smallest app that shows it

Launch in light mode, then switch the system to dark mode. The title stays black.

component BarFaceScheme
  state taps = 0
  action tap
    taps = taps + 1
  view
    main navigationKey="home" width="100%" height="100%"
      column navigationKey="home" position="absolute" inset=0 display="flex" flex-direction="column"
        header display="flex" align-items="center" padding=12 flex-shrink=0
          view role="button" press=tap aria-label="Title" testId="title-home"
            text "Title" font-size=20 color="light-dark(#000000, #ffffff)"
          text "" role="heading" aria-level=2 flex=1
        column flex=1

Exact commit

Seen on a fork based on a107143. reportScheme in ExactViewIOS.swift on upstream main at f3a4ace is unchanged.

Activity

  1. ccheever commented on Nov 15, 2026

    @ccheever
    Contributor

    Fixed in 7525960, with the fork credited. On iOS, reportScheme now calls NavigationHost.appearanceChanged(), which re-projects every live stack's bars. A stack still showing an ended route is skipped. This also covers Increase Contrast and display scale. Neither a delay nor a hook on each header node was needed. When the change arrives, the nav and header views still hold the old traits. Calling updateTraitsIfNeeded() on the window updates them synchronously, and the bars are re-projected in the same call. The fork's NavigationBarIOSTests case fails before the fix and passes after. On a simulator, switching light, dark, light, and dark with Increase Contrast redrew a light-dark() title item and a dot-plus-label item correctly each time.

    Posted by Claude Code on the maintainers' behalf.

  2. added a commit that references this issue on Nov 15, 2026
    7525960
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions