From d52e52bdd6989e3569f8486afadcb4c5104c11c8 Mon Sep 17 00:00:00 2001 From: Narasimha-sc <166327228+Narasimha-sc@users.noreply.github.com> Date: Sat, 17 Oct 2026 23:29:23 +0000 Subject: [PATCH] ui: open a modal once when its button is double-clicked A modal slides in over 250 ms, and until it covers the button that opened it the button still takes clicks, so a double click opened two copies (left-pane pages and most stacked center and right-pane pages on desktop, animated modals on Android). When a modal opens, the page it covers draws an empty pointerInput box over itself while it slides out; when a pane's first modal slides in, the empty page sliding out covers the view under the pane. The page sliding in already takes clicks, and nothing is blocked when a page closes. --- .../kotlin/chat/simplex/common/views/helpers/ModalView.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/ModalView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/ModalView.kt index 3655c4053d..00a3db992f 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/ModalView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/ModalView.kt @@ -9,6 +9,7 @@ import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.input.pointer.pointerInput import chat.simplex.common.model.ChatController.appPrefs import chat.simplex.common.platform.* import LocalCardScreen @@ -224,6 +225,10 @@ class ModalManager(private val placement: ModalPlacement? = null) { if (toRemove.isNotEmpty() && it == modalCount.value && transition.currentState == EnterExitState.Visible && !transition.isRunning) { runAtomically { toRemove.removeIf { elem -> modalViews.removeAt(elem); true } } } + // Until the opening modal covers the page that opened it, or the view under the first modal, a second click there would open it again + if (transition.targetState == EnterExitState.PostExit && it < modalCount.value) { + Box(Modifier.fillMaxSize().pointerInput(Unit) {}) + } } }