typeahead: Fix typeahead positioning for iOS keyboard case.

When the iOS keyboard is open and up, the positioning gotten by
getBoundingClientRect will display a `top` value that is short by the
height of the keyboard, which will usually end up placing things north
of the top of the screen.

By changing to jQuery $.fn.offset instead, the positioning appears to
be correct in all cases; iOS keyboard up, down, and desktop usage.

Fixes: #6366.
This commit is contained in:
Brock Whittaker 2017-10-04 17:35:43 -07:00 committed by Tim Abbott
parent 3b50bc82e0
commit 0c42e4a705
1 changed files with 3 additions and 0 deletions

View File

@ -1874,6 +1874,9 @@
height: this.$element[0].offsetHeight height: this.$element[0].offsetHeight
}) })
// Zulip patch: Workaround for iOS safari problems
pos.top = this.$element.offset().top;
var top_pos = pos.top + pos.height var top_pos = pos.top + pos.height
if (this.dropup) { if (this.dropup) {
top_pos = pos.top - this.$menu.outerHeight() top_pos = pos.top - this.$menu.outerHeight()