1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-11-26 01:30:22 +02:00
comprehensive-rust/speaker-notes.css
Martin Geisler b7de49e1b8 Simplify state transitions for speaker notes
Before, we attempted to change state from “popup” to “inline-open”
when the speaker note window was closed.

We did this by listening to “pagehide” and change the state there. The
event fires every time you navigate away from the page, so we had a
complex setup where we would reset the state to “popup” when the next
page was loaded into the speaker note window.

The problem with this is that it’s racy: we could end up in a
situation where we set the state to “inline-open” right after the
speaker note window was updated. When that happened, we would mark the
window as “defunct”, meaning that it was supposed to be closed.

With this change, we no longer try to change the state from the
speaker note window. If the window is lost (closed), the user will
have to click the “Close speaker notes” button in the top-right to
reset the state. This should be much more reliable.

Long-term, a better solution would be to let the speaker notes fetch
the current URL using JavaScript instead of doing it via an actual
page navigation. That should allow us to react to “pagehide” events
again (since they won’t fire on every page transition).
2023-01-12 12:31:26 +01:00

32 lines
589 B
CSS

.content details {
background: var(--sidebar-bg);
color: var(--sidebar-fg) !important;
border-radius: 0.25em;
padding: 0.25em;
}
.content details summary h4 {
display: inline-block;
list-style: none;
font-weight: normal;
font-style: italic;
margin: 0.5em 0.25em;
cursor: pointer;
}
.content details summary h4:target::before {
margin-left: -40px;
width: 40px;
}
.content details summary .pop-out {
color: var(--icons);
padding: 0 8px;
cursor: pointer;
transition: color 0.5s;
}
.content details summary .pop-out i:hover {
color: var(--icons-hover);
}