Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table of contents toggle for low-width devices #314

Merged
merged 1 commit into from
Oct 1, 2021

Conversation

jryans
Copy link
Member

@jryans jryans commented Sep 12, 2021

This adds a button to show / hide the TOC column on low-width devices.

It also adjusts various styles to keep the top bar fixed as you scroll so that the TOC toggle button remains accessible anywhere in the document. Flexbox is used in the low-width nav bars to improve vertical centering.

The appearance on high-width devices is unchanged. No TOC button is shown there.

toggle-toc.mov

Fixes #313
Also fixes #305

@sorawee
Copy link
Contributor

sorawee commented Sep 12, 2021

This is very nice! And it also avoids the problem in #305!

@jryans
Copy link
Member Author

jryans commented Sep 12, 2021

And it also avoids the problem in #305!

Ah yeah, indeed, the z-index tweaks I made while overlaying the TOC column also resolve that issue as well. 🙂

@mflatt
Copy link
Member

mflatt commented Oct 1, 2021

Checking before merging: Would it be better to use "TOC" instead of "toc", since it's an abbreviation? I'm guessing that "contents" would be too wide.

@jryans
Copy link
Member Author

jryans commented Oct 1, 2021

@mflatt Thanks for taking a look! 🙂 I wasn’t quite sure what label would be best… Mainly I felt a short lowercase label would fit in best next to top, up, etc., but you’re right that “TOC” is more grammatically correct… Perhaps “nav” (as a short form of navigation) could work as an alternative?

@jryans
Copy link
Member Author

jryans commented Oct 1, 2021

It does seem like there’s enough room for “contents” as well, though it’s a tad longer than the other navigation actions.

@mflatt
Copy link
Member

mflatt commented Oct 1, 2021

I don't have a strong opinion, and maybe someone else will have a good idea. But if "contents" fits on relevant screen sizes, then I lean toward that.

This adds a button to show / hide the TOC column on low-width devices.

It also adjusts various styles to keep the top bar fixed as you scroll so that
the TOC toggle button remains accessible anywhere in the document. Flexbox is
used in the low-width nav bars to improve vertical centering.

Fixes racket#313
@jryans
Copy link
Member Author

jryans commented Oct 1, 2021

@mflatt Okay, I have updated to use "contents". It appears to fit down to the iPhone SE size (320 px). Even smaller devices do exist, but the current overall document style needs some tweaking for such small sizes (you start to get horizontal scrolling of the whole page etc.), so I think this feature is okay in assuming "at least 320 px".

@mflatt mflatt merged commit a38c141 into racket:master Oct 1, 2021
@mflatt
Copy link
Member

mflatt commented Oct 1, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add button to toggle TOC column on low-width devices Code content can overlap with sidebar
3 participants