From 74c2bc674ecf69dfd1519fef1be3b2e89d49bc41 Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Thu, 18 Mar 2021 10:55:01 -0400 Subject: [PATCH] Reset single-line TextBox scroll position on focus loss - closes #1125 - progress on #1652 --- druid/src/widget/textbox.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/druid/src/widget/textbox.rs b/druid/src/widget/textbox.rs index f7e752120b..56f20e312e 100644 --- a/druid/src/widget/textbox.rs +++ b/druid/src/widget/textbox.rs @@ -442,6 +442,9 @@ impl Widget for TextBox { ctx.invalidate_text_input(druid_shell::text::Event::SelectionChanged); } self.inner.wrapped_mut().child_mut().has_focus = false; + if !self.multiline { + self.inner.wrapped_mut().scroll_to(Rect::ZERO); + } self.cursor_timer = TimerToken::INVALID; self.was_focused_from_click = false; ctx.request_paint();