Skip to content

Commit 5962468

Browse files
authored
Fix sidebar toggle flickering on page load (#1868)
1 parent e305f27 commit 5962468

8 files changed

+23
-23
lines changed

assets/css/layout.css

+5-8
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ body {
4141
}
4242

4343
.sidebar-button {
44-
--sidebarButtonRightOpen: 4px;
4544
position: fixed;
4645
z-index: 200;
4746
top: 0;
4847
left: 0;
49-
transition: all var(--sidebarTransitionDuration) ease-in-out;
5048
will-change: transform;
51-
margin-top: 10px;
49+
}
50+
51+
.sidebar-toggle--animated.sidebar-button {
52+
transition: transform var(--sidebarTransitionDuration) ease-in-out;
5253
}
5354

5455
.content {
@@ -73,7 +74,7 @@ body {
7374
}
7475

7576
body:is(.sidebar-opening, .sidebar-opened) .sidebar-button {
76-
transform: translateX(calc(var(--sidebarWidth) - 100% - var(--sidebarButtonRightOpen)));
77+
transform: translateX(calc(var(--sidebarWidth) - 100%));
7778
}
7879

7980
body.sidebar-opening-start .sidebar {
@@ -121,10 +122,6 @@ body.sidebar-closed .content {
121122
left: 0;
122123
}
123124

124-
body.sidebar-closed .sidebar-button {
125-
margin: 10px 8px;
126-
}
127-
128125
@media screen and (max-width: 768px) {
129126
.content,
130127
body.sidebar-opening .content {

assets/css/sidebar.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@
398398
cursor: pointer;
399399
background-color: transparent;
400400
border: none;
401-
padding: 18px 8px 18px 11px;
401+
padding: 28px 12px 18px 19px;
402402
font-size: var(--sidebarFontSize);
403403
}
404404

assets/js/sidebar/sidebar-drawer.js

+3
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ function setDefaultSidebarState () {
7474
setClass(SIDEBAR_CLASS.opened)
7575
qs(SIDEBAR_TOGGLE_SELECTOR).setAttribute('aria-expanded', 'true')
7676
}
77+
78+
// apply transition after the default state has been set so the animation does not show on initial page load
79+
setTimeout(() => qs(SIDEBAR_TOGGLE_SELECTOR).classList.add('sidebar-toggle--animated'), ANIMATION_DURATION)
7780
}
7881

7982
function isScreenSmall () {

formatters/html/dist/html-GFE2JU6H.js renamed to formatters/html/dist/html-ULE7KFZ2.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

formatters/html/dist/html-elixir-2O34B7FU.css

-6
This file was deleted.

formatters/html/dist/html-elixir-4FQOSVKU.css

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

formatters/html/dist/html-erlang-GIY63A7R.css

-6
This file was deleted.

formatters/html/dist/html-erlang-I77ZGSQD.css

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)