From a77d5d0cefd11c1a6bd4bc7cb09de21755d1c365 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 3 Sep 2015 00:09:44 +0800 Subject: [PATCH] UX: Make autocomplete usable on mobile. --- app/assets/javascripts/discourse/lib/autocomplete.js.es6 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/discourse/lib/autocomplete.js.es6 b/app/assets/javascripts/discourse/lib/autocomplete.js.es6 index 7750475c3ba..6b7ec5e1407 100644 --- a/app/assets/javascripts/discourse/lib/autocomplete.js.es6 +++ b/app/assets/javascripts/discourse/lib/autocomplete.js.es6 @@ -220,6 +220,13 @@ export default function(options) { vOffset = div.height(); } + if (Discourse.Mobile.mobileView && !isInput) { + div.css('width', 'auto'); + + if ((me.height() / 2) >= pos.top) { vOffset = -23; } + if ((me.width() / 2) <= pos.left) { hOffset = -div.width(); } + } + var mePos = me.position(); var borderTop = parseInt(me.css('border-top-width'), 10) || 0; div.css({