From d30453908b66d604dd4e66a48d0dc139759ac801 Mon Sep 17 00:00:00 2001 From: Rolf Smit Date: Mon, 27 Apr 2026 23:17:51 +0200 Subject: [PATCH] Fix: Delay tooltip to avoid mispositioned caret during screen transitions --- .../presentation/component/PathwayButtonsComponent.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/composeApp/src/commonMain/kotlin/org/neotech/app/abysner/presentation/component/PathwayButtonsComponent.kt b/composeApp/src/commonMain/kotlin/org/neotech/app/abysner/presentation/component/PathwayButtonsComponent.kt index b97142a..7c7a91c 100644 --- a/composeApp/src/commonMain/kotlin/org/neotech/app/abysner/presentation/component/PathwayButtonsComponent.kt +++ b/composeApp/src/commonMain/kotlin/org/neotech/app/abysner/presentation/component/PathwayButtonsComponent.kt @@ -12,6 +12,7 @@ package org.neotech.app.abysner.presentation.component +import androidx.compose.animation.core.AnimationConstants import androidx.compose.foundation.Canvas import androidx.compose.foundation.clickable import androidx.compose.foundation.horizontalScroll @@ -58,7 +59,9 @@ import androidx.compose.ui.text.drawText import androidx.compose.ui.text.rememberTextMeasurer import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import kotlinx.coroutines.delay import kotlinx.coroutines.launch +import kotlin.time.Duration.Companion.milliseconds @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -201,6 +204,9 @@ private fun SelectableButton( LaunchedEffect(showEditTooltip) { if (showEditTooltip) { + // Delay showing the tooltip, to wait for screen animations to settle after + // navigating to this screen or closing a bottom sheet. + delay(AnimationConstants.DefaultDurationMillis.milliseconds) tooltipState.show() } }