Skip to content

Fix toast overlay blocking touches outside visible bounds#4

Open
mattisssa wants to merge 3 commits intounionst:mainfrom
1feed:main
Open

Fix toast overlay blocking touches outside visible bounds#4
mattisssa wants to merge 3 commits intounionst:mainfrom
1feed:main

Conversation

@mattisssa
Copy link

Problem

The toast's scroll-to-dismiss ScrollView is constrained in height via .frame(height:) but spans the full screen width. Since
PassThroughWindow.hitTest returns any hit on a non-root subview, the full-width UIScrollView intercepts touches in the empty area to the
left and right of the toast pill — making that region non-interactive for the app underneath.

Fix

  • Track contentWidth in ToastManager alongside the existing contentHeight
  • Apply both dimensions to the ScrollView frame so its hit area matches the visible toast content
  • Expand the parent VStack to full width so the now-narrower ScrollView stays horizontally centered (GeometryReader defaults to
    top-leading alignment)

The ScrollView used for swipe-to-dismiss was constrained in height
but spanned the full screen width. PassThroughWindow only passes
touches that land on the root view, so the full-width UIScrollView
intercepted taps in the gutters beside the toast pill.

Track contentWidth alongside contentHeight and apply both to the
ScrollView frame so its hit area matches the visible toast content.
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