From 98afa972970d1c403f13ac4bb987561783c52a10 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 21 Sep 2021 09:12:17 +0000 Subject: [PATCH] [FIX] website: properly handle "100% height" snippet when in popups Before this commit, when a "100% height" snippet was set in a popup snippet, it was still computed to take full-screen height minus the size of the navbar. Now, it will properly be full-height. closes odoo/odoo#76913 X-original-commit: 008d776e2f35916c00e0c80daa51a0526de44a21 Signed-off-by: Quentin Smetz (qsm) --- .../static/src/js/content/snippets.animation.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/js/content/snippets.animation.js b/addons/website/static/src/js/content/snippets.animation.js index 94ee91fb7ea..7e9a04d07f9 100644 --- a/addons/website/static/src/js/content/snippets.animation.js +++ b/addons/website/static/src/js/content/snippets.animation.js @@ -915,7 +915,12 @@ registry.FullScreenHeight = publicWidget.Widget.extend({ * @override */ start() { - if (this.$el.outerHeight() > this._computeIdealHeight()) { + this.inModal = !!this.el.closest('.modal'); + + // TODO maybe review the way the public widgets work for non-visible-at- + // load snippets -> probably better to not do anything for them and + // start the widgets only once they become visible..? + if (this.$el.is(':not(:visible)') || this.$el.outerHeight() > this._computeIdealHeight()) { // Only initialize if taller than the ideal height as some extra css // rules may alter the full-screen-height class behavior in some // cases (blog...). @@ -949,6 +954,10 @@ registry.FullScreenHeight = publicWidget.Widget.extend({ */ _computeIdealHeight() { const windowHeight = $(window).outerHeight(); + if (this.inModal) { + return (windowHeight - $('#wrapwrap').position().top); + } + // Doing it that way allows to considerer fixed headers, hidden headers, // connected users, ... const firstContentEl = $('#wrapwrap > main > :first-child')[0]; // first child to consider the padding-top of main