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

The title bar does not completely cover sidebar texts #962

Closed
3 tasks done
object-kaz opened this issue Jul 11, 2022 · 9 comments · Fixed by #968
Closed
3 tasks done

The title bar does not completely cover sidebar texts #962

object-kaz opened this issue Jul 11, 2022 · 9 comments · Fixed by #968
Labels
bug Something isn't working theme Related to the theme

Comments

@object-kaz
Copy link
Contributor

object-kaz commented Jul 11, 2022

Describe the bug

The title bar can not completely cover sidebar texts.
81e7ba36bd7d0197428bcf36a31e0308

Reproduction

  1. clone this repo
  2. run pnpm install
  3. run pnpm build
  4. run pnpm docs-dev
  5. open the page and then click Guide
  6. scroll the sidebar

81e7ba36bd7d0197428bcf36a31e0308

Expected behavior

The title bar can completely cover the sidebar text.
dedb7f092bdd71196d7005e160b6b408

System Info

System:
    OS: macOS 12.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 92.30 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.3.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.11.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 103.0.5060.114
    Firefox: 91.4.1
    Safari: 15.5

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@object-kaz object-kaz added the bug: pending triage Maybe a bug, waiting for confirmation label Jul 11, 2022
@brc-dd
Copy link
Member

brc-dd commented Jul 11, 2022

What's the issue again? This is the output on my system:

image

@object-kaz
Copy link
Contributor Author

What's the issue again? This is the output on my system:

image
It seems to be related to the width of the page.

@object-kaz
Copy link
Contributor Author

Device Resolution: 2560 × 1600

Execute:

{clientWidth: document.documentElement.clientWidth, innerWidth: window.innerWidth, innerWidthScreen: screen.innerWidth, devicePixelRatio:window.devicePixelRatio}

Result:

{
    "clientWidth": 1425,
    "innerWidth": 1440,
    "devicePixelRatio": 2
}

@brc-dd
Copy link
Member

brc-dd commented Jul 11, 2022

image

Still not able to reproduce.

@object-kaz
Copy link
Contributor Author

image

Still not able to reproduce.

Scrollbars may also have an impact.

Scrollbar width: 15px
Window width: 1440px

For selector .VPNavBar, padding-left=32px
image

For selector .VPNavBar>.container,max-width=1440px-64px=1376px,width=1440px-15px-64px=1361px<1376px
image

For selector .VPSidebar, 100% padding=1440px-15px=1425px,calc((100% - (var(--vp-layout-max-width) - 64px)) / 2)=(1425px-(1440px-64px))/2=24.5px
image

image

@object-kaz
Copy link
Contributor Author

I wrote two functions to calculate the padding:

let paddingLeftTitle = (width,scrollbarWidth) => (width-scrollbarWidth-Math.min(1376,width-scrollbarWidth-64))/2
let paddingLeftSidebar = (width,scrollbarWidth) => (width-scrollbarWidth-1376)/2

For $1440 \le width&lt;1440+scrollbarWidth$,
$paddingLeftTitle=32$
$paddingLeftSidebar=(width-scrollbarWidth-1376)/2&lt;32$

For $width \ge 1440+scrollbarWidth$,
$paddingLeftTitle=(width-scrollbarWidth-1376)/2=paddingLeftSidebar$

@brc-dd
Copy link
Member

brc-dd commented Jul 11, 2022

Yeah, cool finally reproduced this 😅

image

@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 Jul 11, 2022
@brc-dd
Copy link
Member

brc-dd commented Jul 11, 2022

Changing this seems to fix this:

padding-left: calc((100% - (var(--vp-layout-max-width) - 64px)) / 2);

padding-left: max(32px, calc((100% - (var(--vp-layout-max-width) - 64px)) / 2));

Check if this works fine for you too.

@object-kaz
Copy link
Contributor Author

Changing this seems to fix this:

padding-left: calc((100% - (var(--vp-layout-max-width) - 64px)) / 2);

padding-left: max(32px, calc((100% - (var(--vp-layout-max-width) - 64px)) / 2));

Check if this works fine for you too.

Yes, it works!

brc-dd pushed a commit that referenced this issue Jul 12, 2022
Co-authored-by: ObjectKaz <shushitong@baidu.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working theme Related to the theme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants