From 7a45fe0120f64078ce8b42ad5454f9dfa8872b7c Mon Sep 17 00:00:00 2001 From: "rene.schakmann" Date: Mon, 19 Oct 2026 17:25:49 +0200 Subject: [PATCH] Allow re-attaching a removed screenshot when reporting a problem The PhotosPicker selection binding was never cleared when removing the screenshot, so the picker kept showing the item as selected and picking it again didn't change the binding, meaning onChange never fired and the image couldn't be attached again. Reset the selection on removal. Fixes #6258 Co-Authored-By: Claude Opus 5.5 --- .../Screens/BugReportScreen/View/BugReportScreen.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift b/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift index fee2423b3..170c32e98 100644 --- a/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift +++ b/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift @@ -117,7 +117,7 @@ struct BugReportScreen: View { .accessibilityIdentifier(A11yIdentifiers.bugReportScreen.screenshot) .accessibilityLabel(L10n.screenBugReportA11yScreenshot) .overlay(alignment: .topTrailing) { - Button { context.send(viewAction: .removeScreenshot) } label: { + Button(action: removeScreenshot) { CompoundIcon(\.close, size: .small, relativeTo: .compound.bodyMD) .foregroundStyle(.compound.iconSecondary) .background { @@ -152,6 +152,12 @@ struct BugReportScreen: View { .disabled(context.viewState.shouldDisableInteraction) } } + + private func removeScreenshot() { + // Otherwise the picker keeps the item checked and re-picking it doesn't trigger onChange. + selectedScreenshot = nil + context.send(viewAction: .removeScreenshot) + } } // MARK: - Previews