Skip to content

Fix dead list-item taps and unthemed List background on iOS - #35

Merged
shanerbaner82 merged 1 commit into
mainfrom
fix/ios-list-taps-and-background
Aug 4, 2026
Merged

Fix dead list-item taps and unthemed List background on iOS#35
shanerbaner82 merged 1 commit into
mainfrom
fix/ios-list-taps-and-background

Conversation

@shanerbaner82

Copy link
Copy Markdown
Contributor

Two independent iOS renderer gaps, both found by dogfooding a settings screen built on native:list:

1. List-item rows are mostly tap-dead

applyClickHandlers attaches onTapGesture, but without a content shape SwiftUI only registers taps on opaque pixels — the padding and the Spacer gap between the text block and trailing content (i.e. most of the row) do nothing. @tap on a <native:list-item> effectively required hitting the text exactly; sparse rows felt completely dead. Verified by dumping the wire tree (on_press correctly registered) and then reading the renderer.

Fix: .contentShape(Rectangle()) before the click handlers — the whole row bounds becomes hittable. Android is unaffected (Compose .clickable covers full bounds).

Note: the mail demo's @tap="open(...)" rows have the same latent issue — dense rows just make lucky hits more common.

2. List ignores the app theme background

SwiftUI's List paints systemGroupedBackground and ignores the node's own background style, so <native:list class="bg-theme-background"> rendered on the stock iOS gray — visibly off-palette in dark mode. Fix: when the node declares a background, .scrollContentBackground(.hidden) + paint the node's resolved color (light/dark variant, same resolution as NodeStyleModifier). Lists without a declared background keep the stock appearance.

Verified in a themed app in both modes (background pixel-checked against the theme token).

🤖 Generated with Claude Code

Two independent iOS renderer gaps:

1. List-item rows attached onTapGesture via applyClickHandlers but never
   set a content shape, so taps only registered on opaque pixels — the
   padding and the Spacer gap between the text block and trailing
   content (most of the row) were tap-dead. @tap on a list-item
   effectively required hitting the text exactly. Add
   .contentShape(Rectangle()) before the click handlers so the whole
   row bounds is hittable. (Compose already covers full bounds via
   .clickable — Android was unaffected.)

2. SwiftUI's List paints the system (grouped) background and ignored
   the node's own background style, so a themed screen
   (bg-theme-background) rendered on stock systemGroupedBackground
   instead of the app palette. When the node declares a background,
   hide the system scroll background and paint the node's resolved
   color (light or dark variant) — matching how every other container
   element behaves. Lists without a declared background are unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shanerbaner82
shanerbaner82 merged commit ffcf726 into main Aug 4, 2026
3 checks passed
@shanerbaner82
shanerbaner82 deleted the fix/ios-list-taps-and-background branch August 4, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant