From 81c15c9c6ce20f8ba7e06bfe61477c2ec24ca084 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 21 Aug 2023 14:17:55 +0200 Subject: [PATCH] Fix layout shifts caused by early rendering passes The previous CSS code relied on `.content:not(:last-child)` to reserve the space required for the right sidebar. This selector does not work as expected when the browser does an early rendering pass while the `.content` block is still open. It causes the space for the sidebar to be reserved but once the parsing continues the browser realizes that there is no sidebar (=`.content` is the last child) and layout is visually updated. See https://www.woltlab.com/community/thread/301233-template-list-behavior-when-sorting-results/ --- com.woltlab.wcf/templates/footer.tpl | 45 ++----------------- com.woltlab.wcf/templates/header.tpl | 39 +++++++++++++++- .../install/files/style/layout/layout.scss | 11 +++-- 3 files changed, 47 insertions(+), 48 deletions(-) diff --git a/com.woltlab.wcf/templates/footer.tpl b/com.woltlab.wcf/templates/footer.tpl index 1139f44d8b..5977933dee 100644 --- a/com.woltlab.wcf/templates/footer.tpl +++ b/com.woltlab.wcf/templates/footer.tpl @@ -20,51 +20,14 @@ {@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.footer.content')} {/if} - - {capture assign='__sidebarRightContent'} - {event name='boxesSidebarRightTop'} - - {* WCF2.1 Fallback *} - {if !$sidebar|empty} - {if !$sidebarOrientation|isset || $sidebarOrientation == 'right'} - {@$sidebar} - {/if} - {/if} - - {if !$sidebarRight|empty} - {@$sidebarRight} - {/if} - - {foreach from=$__wcf->getBoxHandler()->getBoxes('sidebarRight') item=box} - {@$box->render()} - {/foreach} - - {event name='boxesSidebarRightBottom'} - {/capture} - - {if $__sidebarRightContent|trim} + + {hascontent} - {/if} + {/hascontent} diff --git a/com.woltlab.wcf/templates/header.tpl b/com.woltlab.wcf/templates/header.tpl index b9839e5d68..90db1ed7f9 100644 --- a/com.woltlab.wcf/templates/header.tpl +++ b/com.woltlab.wcf/templates/header.tpl @@ -104,8 +104,45 @@ {/hascontent} + + {capture assign='__sidebarRightContent'} + {if MODULE_WCF_AD && $__disableAds|empty && $__wcf->getAdHandler()->getAds('com.woltlab.wcf.sidebar.top')} +
+
+ {@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.sidebar.top')} +
+
+ {/if} + + {event name='boxesSidebarRightTop'} + + {* WCF2.1 Fallback *} + {if !$sidebar|empty} + {if !$sidebarOrientation|isset || $sidebarOrientation == 'right'} + {@$sidebar} + {/if} + {/if} + + {if !$sidebarRight|empty} + {@$sidebarRight} + {/if} + + {foreach from=$__wcf->getBoxHandler()->getBoxes('sidebarRight') item=box} + {@$box->render()} + {/foreach} + + {event name='boxesSidebarRightBottom'} + + {if MODULE_WCF_AD && $__disableAds|empty && $__wcf->getAdHandler()->getAds('com.woltlab.wcf.sidebar.bottom')} +
+
+ {@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.sidebar.bottom')} +
+
+ {/if} + {/capture} -
+