From 141290c7402a4e087ce18d60b210f4feeafcebee Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector@hecrj.dev>
Date: Mon, 3 Feb 2025 17:12:08 +0100
Subject: Fix `InputMethod` conflicts with multiple scrollables

---
 widget/src/scrollable.rs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'widget')

diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs
index 0a93584e..053b7df6 100644
--- a/widget/src/scrollable.rs
+++ b/widget/src/scrollable.rs
@@ -727,6 +727,8 @@ where
                     _ => mouse::Cursor::Unavailable,
                 };
 
+                let had_input_method = shell.input_method().is_open();
+
                 let translation =
                     state.translation(self.direction, bounds, content_bounds);
 
@@ -745,10 +747,12 @@ where
                     },
                 );
 
-                if let InputMethod::Open { position, .. } =
-                    shell.input_method_mut()
-                {
-                    *position = *position + translation;
+                if !had_input_method {
+                    if let InputMethod::Open { position, .. } =
+                        shell.input_method_mut()
+                    {
+                        *position = *position + translation;
+                    }
                 }
             };
 
-- 
cgit