From 44ab9cd966ac17df3079ac16b6b4df0cd2f60e27 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 16 Oct 2026 14:38:02 +0200 Subject: [PATCH] fix(identity): stop a leaving surface from taking back --- .../main/kotlin/de/jeanlucmakiola/floret/identity/Motion.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/identity/src/main/kotlin/de/jeanlucmakiola/floret/identity/Motion.kt b/identity/src/main/kotlin/de/jeanlucmakiola/floret/identity/Motion.kt index b91a0a7..c7ae13e 100644 --- a/identity/src/main/kotlin/de/jeanlucmakiola/floret/identity/Motion.kt +++ b/identity/src/main/kotlin/de/jeanlucmakiola/floret/identity/Motion.kt @@ -87,7 +87,8 @@ fun Modifier.animateContentSizeMotion(reduceMotion: Boolean = rememberReduceMoti * the surface leaves and dropped the moment it is shown again, so reopening it * mid-exit never starts from the shrunk state; a back that leaves it visible * settles back. Null when the caller doesn't track it: the preview is then held - * for a fixed time before settling back. + * for a fixed time before settling back. A surface that is leaving no longer + * takes back, so a second press reaches the screen underneath. */ @Composable fun Modifier.predictiveBack( @@ -104,7 +105,7 @@ fun Modifier.predictiveBack( if (visible == true) progress.snapTo(0f) } - PredictiveBackHandler(enabled = enabled) { events -> + PredictiveBackHandler(enabled = enabled && visible != false) { events -> try { events.collect { event -> fromLeftEdge = event.swipeEdge == BackEventCompat.EDGE_LEFT