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

ENH: CSS only sidebar toggling #454

Merged
merged 4 commits into from
Jan 14, 2022

Conversation

choldgraf
Copy link
Member

@choldgraf choldgraf commented Jan 8, 2022

This is updates our left sidebar behavior so that instead of using javascript functions to control the display of the left sidebar with a class, instead we use a CSS input box + :checked to toggle its visibility. This will make these pages a bit lighter and less-complex, and make them more robust if wonky things happen with javascript on the page.

It also implements Furo-style left sidebar behavior on mobile devices, so that the whole left sidebar pops up in an overlay and you close it by clicking elsewhere on the screen.

Old behavior

(shown on widescreen first, then mobile) (sorry for the red tint)

RtDtZ49OZj

New behavior

Note that the left TOC closes automatically, because it will be hidden by default on pageload on mobile

gFg5I9auA1

Refs

closes #366
closes #355
closes executablebooks/jupyter-book#1379
closes executablebooks/jupyter-book#1361
closes executablebooks/jupyter-book#950

@choldgraf
Copy link
Member Author

choldgraf commented Jan 9, 2022

Curious if @pradyunsg has any other suggestions here, or if this looks mostly reasonable to you :-)

cc also @AakashGfude since this restructures a little bit of the HTML

@choldgraf choldgraf merged commit ecf0035 into executablebooks:master Jan 14, 2022
@choldgraf choldgraf deleted the css-sidebar branch January 14, 2022 00:32
@@ -9,7 +9,12 @@

<!-- Docs TOC is "d-none d-xl-block col-xl-2" -->
{% block docs_sidebar %}
<div class="col-12 {{ sidebar_width_class }} bd-sidebar site-navigation show{% if is_single_page %} single-page{% endif %}" id="site-navigation">
<!-- Checkboxes to toggle the left sidebar -->
<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an aria-label into this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or a labelled-by?

Copy link
Member

@pradyunsg pradyunsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall!

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