Conversation
…open: false in the configuration) closes #159
|
Whether we want to apply it to the cli documentation is debatable; I've applied it here so it's easier to test. |
|
There’s a related problem here when the sidebar is taller than the window: when you navigate to a page, the sidebar scrolls to the top. The most natural solution would be to use client-side navigation, which would also solve the problem of remembering which sections are open or closed. But to continue the path in this PR, perhaps we could also stash the scroll offset of the sidebar prior to navigating, so that we can restore it when the next page loads? This also makes me realize that we should be using |
mbostock
left a comment
There was a problem hiding this comment.
We can add scroll persistence in a followup PR.
| } | ||
| function toggleDetails(event) { | ||
| if (event.detail > 1) event.preventDefault(); // Prevent double-clicking the summary toggle from selecting text. | ||
| sessionStorage.setItem(`observablehq-sidebar:${this.textContent}`, String(!this.parentElement.open)); |
There was a problem hiding this comment.
Oops, we shouldn’t piggyback on the mousedown event here. We should listen for the toggle event on the parent details instead. I’ll fix.
Open questions:
Done: