mirror of https://github.com/zulip/zulip.git
typeahead: Fix suggestion box positioning on window resize.
The suggestion box was not being repositioned correctly when the window was resized. This commit adds a resizeHandler() function to handle window resizing properly and reposition the suggestion box to its current position. Fixes: #23681.
This commit is contained in:
parent
256e9651b6
commit
caeeddd975
|
@ -93,6 +93,11 @@
|
|||
* only this diff, and not the entire text, is highlighted when undoing,
|
||||
* as would be ideal.
|
||||
*
|
||||
* 9. Re-render on window resize:
|
||||
*
|
||||
* We add a new event handler, resizeHandler, for window.on('resize', ...)
|
||||
* that calls this.show to re-render the typeahead in the correct position.
|
||||
*
|
||||
* ============================================================ */
|
||||
|
||||
import {insert} from "text-field-edit";
|
||||
|
@ -367,6 +372,8 @@ import {get_string_diff} from "../../js/util";
|
|||
.on('click', 'li', this.click.bind(this))
|
||||
.on('mouseenter', 'li', this.mouseenter.bind(this))
|
||||
.on('mousemove', 'li', this.mousemove.bind(this))
|
||||
|
||||
$(window).on('resize', this.resizeHandler.bind(this));
|
||||
}
|
||||
|
||||
, unlisten: function () {
|
||||
|
@ -387,6 +394,12 @@ import {get_string_diff} from "../../js/util";
|
|||
return isSupported
|
||||
}
|
||||
|
||||
, resizeHandler: function() {
|
||||
if(this.shown) {
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
|
||||
, move: function (e) {
|
||||
if (!this.shown) return
|
||||
const pseudo_keycode = get_pseudo_keycode(e);
|
||||
|
|
Loading…
Reference in New Issue