UX: make sure autocomplete does not render off screen

This commit is contained in:
Sam 2018-07-12 17:07:25 +10:00
parent bd760e98af
commit 67bc972d74
1 changed files with 6 additions and 1 deletions

View File

@ -323,10 +323,15 @@ export default function(options) {
var mePos = me.position(); var mePos = me.position();
var borderTop = parseInt(me.css("border-top-width"), 10) || 0; var borderTop = parseInt(me.css("border-top-width"), 10) || 0;
let left = mePos.left + pos.left + hOffset;
if (left < 0) {
left = 0;
}
div.css({ div.css({
position: "absolute", position: "absolute",
top: mePos.top + pos.top - vOffset + borderTop + "px", top: mePos.top + pos.top - vOffset + borderTop + "px",
left: mePos.left + pos.left + hOffset + "px" left: left + "px"
}); });
} }