macOS button text differs from SwiftUI in interaction snapshots
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 74/100
調査の方向性
Issueでアルファのみのテキストマスクを白で描画すると説明されている renderKeyedText から始め、解決済みの前景色をどのように使用しているかを比較します。次に、参照の更新を無効にして ButtonInteractionTests を実行し、有効状態と無効状態のスナップショットケースを確認します。6つすべてのキャプチャがSwiftUIの参照と一致すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Swift
- スター
- 2.5k
- フォーク
- 84
- 平均マージ
- 2時間 10分
- マージ済み PR(30日)
- 62
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenSwiftUIProject/OpenSwiftUI のほかの issue
-
Add Accessibility support対応中かも @Kyle-Ye が 16 日前に担当しました。 オープンarea: accessibility area: hosting-bridge type: feature
OpenSwiftUIProject/OpenSwiftUI#1112 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Add Gauge supportオープンarea: rendering area: view type: feature
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
OpenSwiftUIProject/OpenSwiftUI#1022 ·
メンテナーはふだん 1 日以内に返信
-
area: animation area: rendering contrib: help wanted impact: visual-diff type: bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
OpenSwiftUIProject/OpenSwiftUI#984 ·
メンテナーはふだん 1 日以内に返信
-
Add List supportオープンarea: layout area: rendering area: view type: feature
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
OpenSwiftUIProject/OpenSwiftUI#919 ·
メンテナーはふだん 1 日以内に返信
-
area: layout area: rendering area: view type: feature
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
OpenSwiftUIProject/OpenSwiftUI#918 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
OpenSwiftUIProject/OpenSwiftUI の issue をすべて見る
似ている issue
-
fyi-ecosystem platform-ios team-ios
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
flutter/flutter#194348 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
freestylefly/WeChatBridge#44 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 62/100
swiftwasm/JavaScriptKit#818 ·
-
難易度 2/5 半日 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
capawesome-team/capacitor-plugins#1134 ·
メンテナーはふだん 1 日以内に返信