mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #2279 from keepassxreboot/fix/autocomplete_menu_min_width
Fix Autocomplete Menu widths
This commit is contained in:
commit
61db82045f
1 changed files with 6 additions and 1 deletions
|
|
@ -329,8 +329,13 @@ class Autocomplete {
|
|||
return;
|
||||
}
|
||||
|
||||
// Calculate Y offset if menu does not fit to the bottom of the screen -> show it at the top of the input field
|
||||
// Set container's minimum width to the input field's width
|
||||
const rect = this.input.getBoundingClientRect();
|
||||
this.container.style.minWidth = Pixels(this.input.offsetWidth);
|
||||
// Extend the list's max width to input field's width or at least to the maxWidth defined in the CSS file
|
||||
this.list.style.maxWidth = `max(${Pixels(this.input.offsetWidth)}, 600px)`;
|
||||
|
||||
// Calculate Y offset if menu does not fit to the bottom of the screen -> show it at the top of the input field
|
||||
const menuRect = this.container.getBoundingClientRect();
|
||||
const totalHeight = menuRect.height + rect.height;
|
||||
const menuOffset = totalHeight + rect.y > window.self.visualViewport.height ? totalHeight : 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue