Skip to content

Sidebar scroll not working properly with offset #365

@herrera-ignacio

Description

@herrera-ignacio

Note: This issue might be similar to #360 but slightly different. In this case, the navbar is not hidden behind the navbar.

Precondition

  • Sidebar has enough items to not fit on the screen (i.e., vertical overflow) and becomes scrollable.
  • There's a fixed navbar.

Issue:

  • The navbar creates an offset and makes the sidebar not quite fit on the screen. Therefore, you can't see some items at the end of the sidebar by scrolling (depending on nav height).
  • If you scroll the page, and the navbar hides, you'll be able to side those items.
Screen.Recording.2024-06-05.at.5.55.59.PM.mov

Attempts to solve

  • Swizzling docusaurus-theme-redoc. I was not able to get to the sidebar styling to apply some sort of vertical padding but I think that could be a hot fix. When ejecting the Redoc component (or its dependencies), a lot of relative imports that it uses get broken.
  • I tried applying either scrollYOffset: 50 or scrollYOffset: nav.navbar to fix the issue and it does but it creates another one, the sidebar won't occupy the navbar space when the navbar is hidden, and it looks odd (notice on the following image that the sidebar's right border doesn't reach the top) Another solution could be that the scrollYOffset only applies when the navbar is not present but I don't think the options support this.
image

Ideal scenarios

  • Being able to apply custom styles to the sidebar (e.g., padding-bottom)
  • Being able to swizzle Redoc's sidebar (either Wrap or Eject)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions