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

Refactor TOC HTML/CSS #3

Merged
merged 1 commit into from
Oct 8, 2024
Merged

Refactor TOC HTML/CSS #3

merged 1 commit into from
Oct 8, 2024

Conversation

qwitwa
Copy link
Contributor

@qwitwa qwitwa commented Oct 8, 2024

Fixes #2

This commit introduces a new data attribute added to a top level html node. This attribute is a flag which determines the open/close state of the TOC. CSS rules are rewritten to refrence this. A CSS variable is introduced for controlling TOC width.

The top level container is no longer a grid.

The TOC is rendered offscreen. When it is toggled to display, all of the page content is moved using transforms sideways, revealing the TOC. Because no page elements change size, no reflow occurs, solving the problem in #2.

The close button on the TOC could often scroll out of view. To fix this, the TOC HTML has been tweaked so that a header with the title and close button stays fixed, and only the TOC UL scrolls.

Fixes rubenpieters#2

This commit introduces a new data attribute added to a top level
html node. This attribute is a flag which determines the open/close
state of the TOC. CSS rules are rewritten to refrence this. A CSS variable
is introduced for controlling TOC width.

The top level container is no longer a grid.

The TOC is rendered offscreen. When it is toggled to display, all of the
page content is moved using transforms sideways, revealing the TOC.
Because no page elements change size, no reflow occurs, solving
the problem in rubenpieters#2.

The close button on the TOC could often scroll out of view. To fix this,
the TOC HTML has been tweaked so that a header with the title and close
button stays fixed, and only the TOC UL scrolls.
@rubenpieters rubenpieters merged commit 02adb1e into rubenpieters:main Oct 8, 2024
1 of 2 checks passed
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.

Viewport displaces when toggling table of contents
2 participants