summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/content
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2020-07-30 13:31:21 +0000
committerqsm-odoo <qsm@odoo.com>2020-07-30 14:50:04 +0000
commit90033c95ea133f78a2bfa247da3aae1a8d53f98d (patch)
tree23809417c6bacf9f809cecb49d3d799d3ac18caa /addons/website/static/src/js/content
parent8a57b4ce792eb3227d9d3ef4b844a189903d02a4 (diff)
[FIX] website: prevent page flickering when modal is opened
Commit [1] introduced a flickering when any modal was opened on the frontend. Indeed, it introduced the possibility to go into "fullscreen" mode, which makes the Odoo UI navbar and sidebar disappear. This is animated: the padding of the `<body/>` element is using a CSS transition... but when a Bootstrap modal opens, the padding-right is changed to compensate the scrollbar removal. This change now being animated, it creates a flickering. A generic solution was made: only animate what is animated for the duration of the fullscreen mode switch. [1]: https://github.com/odoo/odoo/commit/0b0690a3934cedcab0d5e34373e8d40c2ab25660 closes odoo/odoo#55210 X-original-commit: ccadb20c82a651e9ef87e818b898f3e9a081cacd Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/website/static/src/js/content')
-rw-r--r--addons/website/static/src/js/content/website_root.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/addons/website/static/src/js/content/website_root.js b/addons/website/static/src/js/content/website_root.js
index fa2a01eecd2..91581d6293f 100644
--- a/addons/website/static/src/js/content/website_root.js
+++ b/addons/website/static/src/js/content/website_root.js
@@ -170,6 +170,7 @@ var WebsiteRoot = publicRootData.PublicRoot.extend(KeyboardNavigationMixin, {
*/
_toggleFullscreen(state) {
this.isFullscreen = state;
+ document.body.classList.add('o_fullscreen_transition');
document.body.classList.toggle('o_fullscreen', this.isFullscreen);
document.body.style.overflowX = 'hidden';
let resizing = true;
@@ -189,6 +190,7 @@ var WebsiteRoot = publicRootData.PublicRoot.extend(KeyboardNavigationMixin, {
resizing = false;
document.body.style.overflowX = '';
document.body.removeEventListener('transitionend', onTransitionEnd);
+ document.body.classList.remove('o_fullscreen_transition');
};
document.body.addEventListener('transitionend', onTransitionEnd);
// Safeguard in case the transitionend event doesn't trigger for whatever reason.