From 421e13d72fc32c3b4f91c4b2b66b1999dda7930c Mon Sep 17 00:00:00 2001 From: mic Date: Sat, 14 Sep 2024 22:25:08 +0200 Subject: [PATCH] scrolling when using the arrows to navigate the prompt list in the shortcut panel --- js/mzta-compose-script.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/mzta-compose-script.js b/js/mzta-compose-script.js index 17ad4048..becd7a91 100644 --- a/js/mzta-compose-script.js +++ b/js/mzta-compose-script.js @@ -230,6 +230,11 @@ async function searchPrompt(allPrompts, tabId, tabType){ if (currentFocus >= items.length) currentFocus = 0; if (currentFocus < 0) currentFocus = items.length - 1; items[currentFocus].classList.add('mzta_autocomplete-item-active'); // Add "active" class to the current item + // Ensure the active item is visible within the scrollable list + items[currentFocus].scrollIntoView({ + behavior: 'auto', // You can change to 'smooth' if you prefer smooth scrolling + block: 'nearest', // Align the item to the nearest edge of the visible area + }); } // Function to remove the "active" class from all items