File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -530,7 +530,6 @@ html:not(.sidebar-resizing) .sidebar {
530
530
/* sidebar-hidden */
531
531
# sidebar-toggle-anchor : not (: checked ) ~ .sidebar {
532
532
transform : translateX (calc (0px - var (--sidebar-width ) - var (--sidebar-resize-indicator-width )));
533
- z-index : -1 ;
534
533
}
535
534
[dir = rtl ] # sidebar-toggle-anchor : not (: checked ) ~ .sidebar {
536
535
transform : translateX (calc (var (--sidebar-width ) + var (--sidebar-resize-indicator-width )));
Original file line number Diff line number Diff line change @@ -521,8 +521,25 @@ aria-label="Show hidden lines"></button>';
521
521
const sidebarToggleButton = document . getElementById ( 'sidebar-toggle' ) ;
522
522
const sidebarToggleAnchor = document . getElementById ( 'sidebar-toggle-anchor' ) ;
523
523
const sidebarResizeHandle = document . getElementById ( 'sidebar-resize-handle' ) ;
524
+ const sidebarCheckbox = document . getElementById ( 'sidebar-toggle-anchor' ) ;
524
525
let firstContact = null ;
525
526
527
+ /* Because we cannot change the `display` using only CSS after/before the transition, we
528
+ need JS to do it. We change the display to prevent the browsers search to find text inside
529
+ the collapsed sidebar. */
530
+ sidebar . addEventListener ( 'transitionend' , ( ) => {
531
+ /* We only change the display to "none" if we're collapsing the sidebar. */
532
+ if ( ! sidebarCheckbox . checked ) {
533
+ sidebar . style . display = 'none' ;
534
+ }
535
+ } ) ;
536
+ sidebarToggleButton . addEventListener ( 'click' , ( ) => {
537
+ /* To allow the sidebar expansion animation, we first need to put back the display. */
538
+ if ( ! sidebarCheckbox . checked ) {
539
+ sidebar . style . display = '' ;
540
+ }
541
+ } ) ;
542
+
526
543
function showSidebar ( ) {
527
544
body . classList . remove ( 'sidebar-hidden' ) ;
528
545
body . classList . add ( 'sidebar-visible' ) ;
You can’t perform that action at this time.
0 commit comments