-
Notifications
You must be signed in to change notification settings - Fork 639
Closed
Labels
Description
When InlineAutocomplete is used at the bottom of a screen, it can overflow and even cause scrollbars to appear. It would be better if it auto-positioned itself to to appear above the caret.
This is a little more challenging than just repositioning the suggestions though, because we have two conflicting goals:
- We want to have the most-relevant suggestion be the one closest to the text, because this is the one inserted if the user presses Enter without navigating into the list. If it's far away, it could be confusing.
- For screen reader / keyboard users, we want the most-relevant suggestion to be at the top of the list so it can quickly be accessed by pressing Down (and because lists are naturally sorted by relevance, descending).
This works fine when the suggestions are below the text:
However, if we reposition the suggestions to be above the insertion point, the two goals conflict.
There are a few options here:
- Simply reposition the suggestions, allowing the most-relevant suggestion to show up farthest from the insertion point. This is the approach taken by VSCode:

- Reposition and reverse the suggestions list so that the most-relevant suggestion is at the bottom of the list
- Reposition and reverse the suggestions list, but keep the same order in the DOM and reverse the keyboard navigation, so that screen reader users don't experience any difference. This is the most ergonomic for screen reader users but would be confusing for sighted keyboard users
My inclination is (1), if only to be consistent with VSCode and other editors.
