From a2703d2982ab9c7e81e562d22fd5c0be4b6de397 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 11 Jun 2025 09:21:27 +0200 Subject: [PATCH] Completer: Detect scroll and don't hide suggestions Still has problems: * Safari won't bother (don't care) * Firefox blurs focus * Autorefresh then resets the view (form.js does not find a focused input) * Suggestions stay open when leaving the searchbar altogether --- asset/js/widget/Completer.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/asset/js/widget/Completer.js b/asset/js/widget/Completer.js index 6d6038024..5f884c691 100644 --- a/asset/js/widget/Completer.js +++ b/asset/js/widget/Completer.js @@ -9,6 +9,7 @@ define(["../notjQuery"], function ($) { this.selectionStartInput = null; this.selectionActive = false; this.mouseSelectionActive = false; + this.scrolling = false; this.nextSuggestion = null; this.activeSuggestion = null; this.suggestionKiller = null; @@ -34,6 +35,8 @@ define(["../notjQuery"], function ($) { $(this.termSuggestions).on('focusout', '[type="button"]', this.onFocusOut, this); $(this.termSuggestions).on('click', '[type="button"]', this.onSuggestionClick, this); $(this.termSuggestions).on('keydown', '[type="button"]', this.onSuggestionKeyDown, this); + $(this.termSuggestions).on('scroll', e => this.scrolling = true); + $(this.termSuggestions).on('scrollend', e => this.scrolling = false); if (this.selectionEnabled()) { $(this.termSuggestions).on('keyup', '[type="button"]', this.onSuggestionKeyUp, this); @@ -475,6 +478,10 @@ define(["../notjQuery"], function ($) { return; } + if (this.scrolling) { + return; + } + let input = event.target; let completedInput = this.completedInput; this.suggestionKiller = setTimeout(() => {