From 1f2e2b75d828044ca25a1ff89235ddbf9e97caeb Mon Sep 17 00:00:00 2001 From: ashutoshkhadse Date: Wed, 14 Jan 2026 09:15:48 +0530 Subject: [PATCH] autocomplete: Reset scroll position when query changes When searching for an emoji (or other autocomplete items), scrolling through results, and then modifying the query, the autocomplete list would retain its scrolled position while showing new results. This created confusing UX where results appeared cut off at the top. Fix this by adding a ScrollController to the autocomplete ListView and resetting the scroll position to the top whenever the query content changes. Fixes: #1175 --- lib/widgets/autocomplete.dart | 7 +++ test/widgets/autocomplete_test.dart | 66 +++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/lib/widgets/autocomplete.dart b/lib/widgets/autocomplete.dart index 3f88778b0b..fed984cccf 100644 --- a/lib/widgets/autocomplete.dart +++ b/lib/widgets/autocomplete.dart @@ -38,6 +38,7 @@ abstract class AutocompleteField extends State> with PerAccountStoreAwareStateMixin> { AutocompleteView? _viewModel; + final ScrollController _scrollController = ScrollController(); void _initViewModel(QueryT query) { _viewModel = widget.initViewModel(context, query) @@ -63,6 +64,10 @@ class _AutocompleteFieldState