Skip to content

Commit dcc645e

Browse files
Semphrisslouken
authored andcommitted
Fix HTML examples template tabs
Tab labels now follow their drawer again. Also, to avoid tabs covering up code or debugging logs, the tab label that's on top (and therefore not automatically hidden behind the other drawer when that drawer opens) will now automatically hide itself when the other drawer is opened.
1 parent ece6a6e commit dcc645e

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

examples/template.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676
}
7777

7878
#output-container::before {
79-
position: fixed;
80-
bottom: 0;
79+
position: absolute;
80+
bottom: 100%;
8181
right: 1rem;
8282

8383
content: 'Console';
@@ -134,15 +134,19 @@
134134
}
135135

136136
#source-code::before {
137-
position: fixed;
138-
bottom: 0;
137+
position: absolute;
138+
bottom: 100%;
139139
left: 1rem;
140140

141141
content: 'Source code';
142142
font-size: 1.5rem;
143143
background: linear-gradient(to bottom, #789, #e0eaee);
144144
padding: 0.75rem 1.5rem;
145145
border-radius: 0.5rem 0.5rem 0 0;
146+
147+
/* Used for a hack to avoid tab labels showing on top of tabs; see
148+
comment below for details. */
149+
transition: bottom 0.25s;
146150
}
147151

148152
#source-code:hover,
@@ -164,6 +168,14 @@
164168
overflow: scroll;
165169
}
166170

171+
/* Hack: Sinze z-index only goes one way, and both tab labels should be
172+
behind each other's tab, put the former on top (higher z-index) and
173+
make the latter one disappear when the former is hovered. */
174+
#output-container:hover ~ #source-code::before,
175+
#output-container:focus-within ~ #source-code::before {
176+
bottom: -100%;
177+
}
178+
167179
@media (prefers-color-scheme: dark) {
168180
main > #sidebar {
169181
border-color: rgba(48, 54, 61, 0.7);

0 commit comments

Comments
 (0)