Skip to content

macOS button text differs from SwiftUI in interaction snapshots #1140

Closed

Description

@Kyle-Ye

Description

Default button labels rendered by OpenSwiftUI differ from SwiftUI at the glyph
edges on macOS. Both enabled and disabled buttons are affected. The differences
remain when the reference and actual images use the same macOS version.

Button actions work: repeated presses update the count, and disabled buttons do
not run their actions. The failures are snapshot mismatches, with no crash.

Reproduction

  • Platform: macOS 15.7.3 (24G419), arm64.
  • Configuration: OpenSwiftUI renderer with IAG.
  • References: SwiftUI snapshots recorded on macOS 15.7.3.
  • Source: The Button implementation merged in #1138.

Run the existing
ButtonInteractionTests
with reference updates disabled. The two cases capture the initial appearance
and the appearance after each of two presses:

  1. actionUpdatesCount: The enabled button displays counts 0, 1, and 2.
  2. disabledButtonDoesNotRunAction: The disabled button keeps count 0.

Expected and actual results

All six captures should match the SwiftUI references. Instead, each capture has
differences confined to the text. The button backgrounds and borders match.

Case Initial After first press After second press
Enabled 604 543 556
Disabled 583 583 583

Values are the number of changed RGBA pixels in each reference/actual pair from
the focused CI run.

The reference, actual, and difference images are available in the snapshot
artifact of the CI run linked above.

Enabled and disabled button snapshots, with enlarged text differences

Findings

A local comparison on macOS 15.7.3 reproduced the CI images. View and layer
geometry, glyph positions, fonts, transforms, and text color matched between the
two renderers.

The difference comes from the fill color used to draw the alpha-only text mask
in renderKeyedText. OpenSwiftUI uses white. On macOS, font smoothing depends on
the fill color even in an alpha-only context, so this changes glyph coverage.
Using the resolved foreground RGB for a solid fill removes the differences in
these button snapshots.

A standalone text probe confirmed that black and white fills produce different
alpha masks on macOS 15.7.3 with font smoothing enabled. The masks match with
smoothing disabled. The same probe on iOS 18.5 produced identical masks for both
colors.

Activity

  1. added
    area: renderingDisplayList, render backends, renderer hosts, drawing, and effects.
    area: textText, labels, line style, and text rendering APIs.
    impact: visual-diffVisual mismatch, screenshot diff, or rendering fidelity issue.
    platform: macOSmacOS-specific behavior or support.
    type: bugSomething is not working correctly.
    on Oct 12, 2026
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

    area: renderingDisplayList, render backends, renderer hosts, drawing, and effects.area: textText, labels, line style, and text rendering APIs.impact: visual-diffVisual mismatch, screenshot diff, or rendering fidelity issue.platform: macOSmacOS-specific behavior or support.type: bugSomething is not working correctly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions