yuku / textcomplete

Autocomplete for HTMLTextAreaElement and more.
https://yuku.takahashi.coffee/textcomplete/
MIT License
1.74k stars 305 forks source link

Dropdown's height incorrectly calculated, dropdown placed offscreen #349

Open mgmeyers opened 2 years ago

mgmeyers commented 2 years ago

Because the dropdown's height is calculated as this.items.length * cursorOffset.lineHeight (https://github.com/yuku/textcomplete/blob/main/packages/textcomplete-core/src/Dropdown.ts#L227) when a max-height is set on the dropdown element, it's height is incorrectly calculated. This means the dropdown will be placed offscreen in certain circumstances, especially when there are a lot of items.

Could this.el.clientHeight be used instead?

This dropdown can show up to 100 items:

Screen Shot 2021-12-28 at 10 31 23 AM

When I narrow the list down, it correctly displays on screen:

Screen Shot 2021-12-28 at 10 45 13 AM