resize: Don’t hide popovers on mobile resize.

Or on the scroll triggered by that resize.

Then we don’t need a kludge that skips the resize handler in
situations where it might hide popovers.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2019-03-14 20:02:27 -07:00
committed by Tim Abbott
parent 87f7a578e6
commit bd50c6a152
3 changed files with 28 additions and 34 deletions

View File

@@ -48,34 +48,6 @@ function message_hover(message_row) {
}
}
function should_skip_mobile_resize() {
// If we are in the mobile browser then we need to handle resize event
// more carefully because virtual keyboard causes resize event to
// trigger and this leads the input elements to loose focus.
if (util.is_mobile()) {
// If user is trying to search other users in right sidebar
// then don't resize due to opening of virtual keyboard in
// mobile browser because this leads the search bar to loose
// focus and it becomes impossible to type in the input field.
if ($('.user-list-filter').is(':focus')) {
return true;
}
// Don't resize when the user is filtering the streams due to the
// reasons mentioned in the previous comment.
if ($('.stream-list-filter').is(':focus')) {
return true;
}
// Don't resize in mobile browser when the user is trying to add
// emoji to the message or trying to react on other message due
// to the reasons mentioned above.
if ($('.emoji-popover-filter').is(':focus')) {
return true;
}
}
// resize in all other cases.
return false;
}
exports.initialize_kitchen_sink_stuff = function () {
// TODO:
// This function is a historical dumping ground
@@ -111,11 +83,7 @@ exports.initialize_kitchen_sink_stuff = function () {
// preventDefault, allowing the modal to scroll normally.
});
$(window).resize(_.throttle(function () {
if (!should_skip_mobile_resize()) {
resize.handler();
}
}, 50));
$(window).resize(_.throttle(resize.handler, 50));
// Scrolling in overlays. input boxes, and other elements that
// explicitly scroll should not scroll the main view. Stop