Skip to content

Fix scrollbar compensation for overlay scrollbars - #228

Merged
infeng merged 1 commit into
masterfrom
codex/fix-scrollbar-compensation-135
Aug 20, 2026
Merged

Fix scrollbar compensation for overlay scrollbars#228
infeng merged 1 commit into
masterfrom
codex/fix-scrollbar-compensation-135

Conversation

@infeng

@infeng infeng commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • measure the actual scrollbar width instead of assuming 15px
  • preserve existing body padding when compensating for a classic scrollbar
  • avoid adding padding for overlay scrollbars such as the macOS behavior reported in pages shaking when viewer show and hide #135

Related to #135. This intentionally does not auto-close the issue before maintainer follow-up.

Reproduction and root cause

Opening the modal viewer hides body overflow. The previous code always added 15px of right padding when the page was scrollable. Overlay scrollbars occupy no layout width, so that padding shifted the page; non-15px scrollbars and pages with existing body padding were also handled incorrectly.

Verification

  • npm run verify
  • Chromium 149 browser check against the demo at 1280x720
    • confirmed a scrollable page with a 0px overlay scrollbar
    • opened the viewer and confirmed no right padding or container shift
    • exercised zoom and closed the viewer
    • confirmed body overflow and padding were restored
  • public npm registry scan passed

@infeng
infeng marked this pull request as ready for review August 20, 2026 09:58
@infeng
infeng merged commit 73426ed into master Aug 20, 2026
2 checks passed
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.

1 participant