[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:
@@ -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
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user