webscopeio / react-textarea-autocomplete

📝 React component implements configurable GitHub's like textarea autocomplete.
MIT License
451 stars 80 forks source link

Suggestion position is wrong #209

Closed darshanksexathought closed 2 years ago

darshanksexathought commented 3 years ago

if (dropdownBottom > containerBounds.bottom) { topPosition = top - dropdownBounds.height; usedClasses.push(POSITION_CONFIGURATION.Y.TOP); unusedClasses.push(POSITION_CONFIGURATION.Y.BOTTOM); } else { topPosition = top; usedClasses.push(POSITION_CONFIGURATION.Y.BOTTOM); unusedClasses.push(POSITION_CONFIGURATION.Y.TOP); }

according to this code, it only checks if the suggestion is going out in the bottom you should also check if it is going out in the top because, if it goes out of the top then you will not see the first element unless you type the exact match, the good user behavior should be he can see the elements in the list from top not from the bottom