macOS button text differs from SwiftUI in interaction snapshots
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Start with renderKeyedText, identified in the issue as using white to draw the alpha-only text mask; compare how it uses the resolved foreground color. Then run ButtonInteractionTests with reference updates disabled and inspect the enabled and disabled snapshot cases. Done means all six captures match the SwiftUI references.
Written by the indexing model from the issue text.
Description
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:
actionUpdatesCount: The enabled button displays counts 0, 1, and 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.
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.
- Dominant language
- Swift
- Stars
- 2.5k
- Forks
- 84
- Avg merge
- 2h 8m
- Merged PRs (30d)
- 62
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenSwiftUIProject/OpenSwiftUI
-
Add Accessibility supportPossibly taken @Kyle-Ye claimed this 15 days ago. Openarea: accessibility area: hosting-bridge type: feature
OpenSwiftUIProject/OpenSwiftUI#1112 · 1 assignee ·
Maintainers usually reply within 1 day
-
Add Gauge supportOpenarea: rendering area: view type: feature
Difficulty 4/5 3-5 days Newbie friendliness 42/100
OpenSwiftUIProject/OpenSwiftUI#1022 ·
Maintainers usually reply within 1 day
-
area: animation area: rendering contrib: help wanted impact: visual-diff type: bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
OpenSwiftUIProject/OpenSwiftUI#984 ·
Maintainers usually reply within 1 day
-
Add List supportOpenarea: layout area: rendering area: view type: feature
Difficulty 5/5 Over a week Newbie friendliness 28/100
OpenSwiftUIProject/OpenSwiftUI#919 ·
Maintainers usually reply within 1 day
-
area: layout area: rendering area: view type: feature
Difficulty 5/5 Over a week Newbie friendliness 35/100
OpenSwiftUIProject/OpenSwiftUI#918 · 1 comment ·
Maintainers usually reply within 1 day
All issues in OpenSwiftUIProject/OpenSwiftUI
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
521xueweihan/HelloGitHub#3940 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Local host row takes the name of an exe.dev VM when /etc/hosts aliases that VM to a loopback addressOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
SRGSSR/pillarbox-apple#1604 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days