[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>
This commit is contained in:
@@ -35,7 +35,6 @@ $o-we-zindex: $o-we-overlay-zindex + 1 !default;
|
||||
z-index: $o-we-zindex;
|
||||
height: var(--o-we-toolbar-height);
|
||||
background-color: $o-we-bg;
|
||||
transition: transform 400ms ease 0s; // For fullscreen
|
||||
|
||||
.note-popover .popover {
|
||||
top: 0 !important;
|
||||
|
||||
@@ -108,7 +108,7 @@ body.editor_enable.editor_has_snippets {
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
|
||||
transition: transform 400ms ease 0s; // Also for fullscreen
|
||||
transition: transform 400ms ease 0s;
|
||||
transform: translateX(-100%);
|
||||
|
||||
&.o_loaded {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -8,22 +8,26 @@ body {
|
||||
// Set frontend direction that will be flipped with
|
||||
// rtlcss for right-to-left text direction.
|
||||
direction: ltr;
|
||||
transition: padding 400ms ease 0s;
|
||||
}
|
||||
body.o_connected_user {
|
||||
padding-top: $o-navbar-height!important;
|
||||
|
||||
&.o_fullscreen_transition {
|
||||
transition: padding 400ms ease 0s;
|
||||
|
||||
#oe_main_menu_navbar, #web_editor-top-edit, #oe_snippets {
|
||||
transition: transform 400ms ease 0s !important;
|
||||
}
|
||||
}
|
||||
&.o_fullscreen {
|
||||
padding-top: 0 !important;
|
||||
|
||||
&.editor_enable.editor_has_snippets {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
#oe_main_menu_navbar, #web_editor-top-edit {
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
|
||||
#oe_snippets {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
@@ -38,7 +42,6 @@ body.o_connected_user {
|
||||
z-index: $zindex-modal - 10;
|
||||
font-family: $o-we-font-family;
|
||||
font-size: 14px;
|
||||
transition: transform 400ms ease 0s; // For fullscreen
|
||||
|
||||
a:hover, a:focus {
|
||||
text-decoration: none;
|
||||
|
||||
Reference in New Issue
Block a user