Skip to content

Allow capturing dialog window content instead of Activities window - #216

Closed
AlanCornthwaiteKatalyst wants to merge 1 commit into
hotwired:mainfrom
AlanCornthwaiteKatalyst:capture-dialog-screen-on-dismiss
Closed

AlanCornthwaiteKatalyst wants to merge 1 commit into
hotwired:mainfrom
AlanCornthwaiteKatalyst:capture-dialog-screen-on-dismiss

Conversation

@AlanCornthwaiteKatalyst

@AlanCornthwaiteKatalyst AlanCornthwaiteKatalyst commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

The Issue #150

The HotwireViewScreenshotHolder was using the Activity window to capture snapshots via PixelCopy. When a web view was inside a BottomSheetDialogFragment (which has its own Dialog and Window), the snapshotting process would accidentally capture the content of the Activity window sitting behind the bottom sheet at that same screen position. This resulted in the background content appearing in the foreground modal as it was dismissed.

The Fix

  • Updated HotwireViewScreenshotHolder: Modified the captureScreenshot method to accept an optional Window parameter. If provided, it uses this specific window for PixelCopy; otherwise, it falls back to the activity window as before.
  • Updated HotwireWebFragmentDelegate: Enhanced the screenshotView() method to check if the current destination fragment is a DialogFragment. If it is, it now retrieves the dialog.window and passes it to the screenshot holder.

@mbarta

mbarta commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! I've included the changes in #217 which will be part of the next library release.

@mbarta mbarta closed this Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants