[FIX] web, mail: recompute popover on content change

Because the position of the popover depends on the size of its content.

Part of task-2270731

X-original-commit: 3066a946ef1ca0973503207d0486515798168fa2
This commit is contained in:
Sébastien Theys
2020-09-23 17:32:33 +00:00
parent 8e248f226d
commit 0ff9eb7307
3 changed files with 31 additions and 1 deletions
@@ -15,6 +15,26 @@ class EmojisPopover extends Component {
this.emojis = emojis;
}
mounted() {
this._update();
}
patched() {
this._update();
}
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
/**
* @private
*/
_update() {
this.trigger('o-popover-compute');
}
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
+10
View File
@@ -194,6 +194,16 @@ odoo.define('web.Popover', function () {
this.state.displayed = false;
}
/**
* Popover must recompute its position when children content changes.
*
* @private
* @param {Event} ev
*/
_onPopoverCompute(ev) {
this._compute();
}
/**
* A resize event will need to 'reposition' the popover close to its
* target.
+1 -1
View File
@@ -496,7 +496,7 @@
</t>
<t t-name="Popover" owl="1">
<div t-att-class="{ 'o_is_open': state.displayed }" t-on-click="_onClick" t-on-o-popover-close="_onPopoverClose">
<div t-att-class="{ 'o_is_open': state.displayed }" t-on-click="_onClick" t-on-o-popover-compute="_onPopoverCompute" t-on-o-popover-close="_onPopoverClose">
<t t-slot="default"/>
<Portal t-if="state.displayed" target="'body'">
<div role="tooltip" class="o_popover" t-ref="popover">