Skip to content

Commit

Permalink
handle sidebar scrolling on state transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
B4nan committed Nov 28, 2024
1 parent 64fe8f8 commit 613e287
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apify-docs-theme/static/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,15 @@ document.addEventListener('scroll', () => {
});

window.addEventListener('load', () => {
redirectOpenApiDocs();

Check failure on line 93 in apify-docs-theme/static/js/custom.js

View workflow job for this annotation

GitHub Actions / Lint app code

'redirectOpenApiDocs' is not defined

// we need to wait a bit more, since the event fires too soon, and a lot of hydration is done after it
setTimeout(() => scrollSidebarItemIntoView(), 1000);

// docusaurus-openapi-docs plugin: scroll sidebar into viewport, no need for a large timeout here
setTimeout(() => scrollOpenApiSidebarItemIntoView(), 100);
});

window.addEventListener('popstate', () => {
setTimeout(() => scrollOpenApiSidebarItemIntoView(), 50);
});

0 comments on commit 613e287

Please sign in to comment.