Skip to content

Improve sidebar: scroll to current page & adjust height#1051

Merged
dgarcia360 merged 6 commits intoscylladb:masterfrom
dgarcia360:docs-refactor-js
Mar 26, 2024
Merged

Improve sidebar: scroll to current page & adjust height#1051
dgarcia360 merged 6 commits intoscylladb:masterfrom
dgarcia360:docs-refactor-js

Conversation

@dgarcia360
Copy link
Copy Markdown
Collaborator

Closes #929
Closes #928

This PR:

  • Refactored the JS in classes (maintenance).
  • The sidebar now scrolls to highlight the current page.
  • The sidebar height was adjusted so that the footer does not overlap it.

How to test

  1. Clone the PR.
  2. Build the docs.
  3. Open Examples > Versions
  4. The sidebar should scroll and highlight the opened page.

@dgarcia360 dgarcia360 requested a review from annastuchlik March 22, 2024 08:27
@dgarcia360 dgarcia360 mentioned this pull request Mar 22, 2024
@dgarcia360
Copy link
Copy Markdown
Collaborator Author

Theme / Unit test workflows will be fixed by #1052

@annastuchlik
Copy link
Copy Markdown
Collaborator

This is a great improvement, and I confirm that the sidebar shows the page I opened, even if it is low on the page tree.

However, a page low on the page tree is always displayed as the last item on the menu after it is clicked, making it hard to notice. Is it possible to make the page stay where it is on the menu before it is clicked? An example is below.

Before I click "Versions," it is high in the sidebar.
image

After I click "Versions", it jumps to the very bottom (so initially, I couldn't notice it is there, as I didn't expect its position to change).
image

@dgarcia360
Copy link
Copy Markdown
Collaborator Author

Thanks, @annastuchlik! I've incorporated your suggestion - now it saves the sidebar scroll position and restoring it when the page loads.

Copy link
Copy Markdown
Collaborator

@annastuchlik annastuchlik left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Left menu doesn't scroll / re-focus / re-expand to the current page Menu / toc doesn't overlay the footer

2 participants