mirror of https://github.com/zulip/zulip.git
typeahead: Fix typeahead overflowing out of window.
When the caret in textarea is around the right end of the screen, typeahead can overflow the window. To fix it, we use tippy's mechanism to keep the tooltip inside the visible boundary.
This commit is contained in:
parent
c88e1291f0
commit
6c500e9a6e
|
@ -455,6 +455,19 @@ export class Typeahead<ItemType extends string | object> {
|
|||
}
|
||||
return [0, gap];
|
||||
},
|
||||
onShow(instance) {
|
||||
if (input_element.type === "textarea") {
|
||||
// Since we use an offset which can partially hide typeahead
|
||||
// at certain caret positions, we need to push it back into
|
||||
// view once we have rendered the typeahead. The movement
|
||||
// feels like an animation to the user.
|
||||
setTimeout(() => {
|
||||
// This detects any overflows by default and adjusts
|
||||
// the placement of typeahead.
|
||||
void instance.popperInstance?.update();
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
// We have event handlers to hide the typeahead, so we
|
||||
// don't want tippy to hide it for us.
|
||||
hideOnClick: false,
|
||||
|
|
Loading…
Reference in New Issue