From e0f5ce21a2d6c4979c4dbdc0295a181b092f2285 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 7 Jan 2024 22:14:13 +0000 Subject: [PATCH] [autocomplete] don't allow completions to overflow the box, or for the box to overflow the screen, see #999 --- ext/autocomplete/script.js | 1 + ext/autocomplete/style.css | 1 + 2 files changed, 2 insertions(+) diff --git a/ext/autocomplete/script.js b/ext/autocomplete/script.js index 7c59a4ea..d37ef9a8 100644 --- a/ext/autocomplete/script.js +++ b/ext/autocomplete/script.js @@ -137,6 +137,7 @@ function renderCompletions(element) { element.parentNode.insertBefore(completions_el, element.nextSibling); let br = element.getBoundingClientRect(); completions_el.style.minWidth = br.width + 'px'; + completions_el.style.maxWidth = 'calc(100vw - 2rem - ' + br.left + 'px)'; completions_el.style.left = window.scrollX + br.left + 'px'; completions_el.style.top = window.scrollY + (br.top + br.height) + 'px'; } diff --git a/ext/autocomplete/style.css b/ext/autocomplete/style.css index 468c8bfa..61069712 100644 --- a/ext/autocomplete/style.css +++ b/ext/autocomplete/style.css @@ -10,6 +10,7 @@ padding: 0; font-size: 1rem; white-space: nowrap; + overflow: hidden; } .autocomplete_completions LI { padding: 0.15em;