Fix closed toc eating clicks with phantom div

Previous behaviour was to remove the toc from view by applying a transform to the .toc > ul but *not* .toc itself.

This meant that .toc was still covering the body when the toc was "closed", eating clicks on anything that would be covered by the toc when opened.

This change puts a transform on .toc itself (and changes the transforms on the ul to match), fixing the issue. However, this creates a new stacking context, which affects .toctogglelabel, since its fixed position is now with respect to .toc, not the viewport. Setting .toctogglelabel { right: -100vw } keeps it in the same place.
This commit is contained in:
Cameron 2020-11-23 16:14:09 +10:30 committed by GitHub
parent f168f14378
commit bf8909e2bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -97,6 +97,7 @@
height: 100%;
margin-top: -@header-height;
padding: 0;
transform: translateX(-100%);
&:before,
&:after {
@ -112,7 +113,7 @@
&label {
position: fixed;
z-index: 7;
right: 0;
right: -100vw;
bottom: 0;
margin: @margin-side;
padding: 0 @margin-side / 2;
@ -144,7 +145,7 @@
}
&checkbox:not( :checked ) ~ ul {
transform: translateX( -300px - @margin-side );
transform: none;
}
}
@ -162,7 +163,7 @@
background: @base-100;
border-radius: 0 @border-radius-large @border-radius-large 0;
.boxshadow(3);
transform: none;
transform: translateX(100%);
transition: @transition-transform;
}
}