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

Local navigation dropdown misplaced without sidebar #4359

Open
4 tasks done
harsssh opened this issue Nov 12, 2024 · 5 comments · May be fixed by #4393
Open
4 tasks done

Local navigation dropdown misplaced without sidebar #4359

harsssh opened this issue Nov 12, 2024 · 5 comments · May be fixed by #4393
Labels
bug Something isn't working contribution welcome The team would welcome a contribution from the community for this issue theme Related to the theme

Comments

@harsssh
Copy link

harsssh commented Nov 12, 2024

Describe the bug

When a site has no sidebar, the local navigation dropdown is incorrectly positioned.
It appears to be offset to the right by the sidebar width, even though there is no sidebar present.

@media (min-width: 960px) {
.items {
right: auto;
left: calc(var(--vp-sidebar-width) + 32px);
width: 320px;
}
}

Reproduction

https://stackblitz.com/edit/vite-dxfigx?file=docs%2F.vitepress%2Fconfig.ts

reproduction

Expected behavior

When there is no sidebar, the dropdown should still appear directly below the "On this page" text, aligned as shown in the image.

expected behavior

System Info

System:
  OS: macOS 14.2.1
  CPU: (8) arm64 Apple M2
  Memory: 140.70 MB / 8.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 22.11.0 - ~/.asdf/installs/nodejs/22.11.0/bin/node
  Yarn: 1.22.22 - ~/.asdf/installs/nodejs/22.11.0/bin/yarn
  npm: 10.9.0 - ~/.asdf/plugins/nodejs/shims/npm
  bun: 1.1.33 - ~/.bun/bin/bun
Browsers:
  Chrome: 130.0.6723.117
  Safari: 17.2.1
npmPackages:
  vitepress: ^1.5.0 => 1.5.0

Additional context

No response

Validations

@harsssh harsssh added the bug: pending triage Maybe a bug, waiting for confirmation label Nov 12, 2024
@brc-dd brc-dd added bug Something isn't working theme Related to the theme and removed bug: pending triage Maybe a bug, waiting for confirmation labels Nov 12, 2024
@brc-dd
Copy link
Member

brc-dd commented Nov 12, 2024

--vp-sidebar-width should be 0 when there is no sidebar

@harsssh
Copy link
Author

harsssh commented Nov 12, 2024

I'd like to work on fixing this bug. May I take this on?

@brc-dd
Copy link
Member

brc-dd commented Nov 12, 2024

Yeah sure! Thanks.

@brc-dd brc-dd added the contribution welcome The team would welcome a contribution from the community for this issue label Nov 12, 2024
@yuxi-ovo yuxi-ovo linked a pull request Nov 28, 2024 that will close this issue
@yuxi-ovo
Copy link

Because he hasn't been active for too long, I completed this task. Please help me. Thank you

@yuxi-ovo
Copy link

@brc-dd Please take a look at my PR.#4393 You will be satisfied. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working contribution welcome The team would welcome a contribution from the community for this issue theme Related to the theme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants