[autocomplete] don't allow completions to overflow the box, or for the box to overflow the screen, see #999

This commit is contained in:
Shish 2024-01-07 22:14:13 +00:00
parent ad4d9c74d4
commit e0f5ce21a2
2 changed files with 2 additions and 0 deletions

View file

@ -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';
}

View file

@ -10,6 +10,7 @@
padding: 0;
font-size: 1rem;
white-space: nowrap;
overflow: hidden;
}
.autocomplete_completions LI {
padding: 0.15em;