Skip to content

fix(docs): allow page scroll to chain past code blocks#24

Merged
max-wells merged 1 commit intorust-ui:mainfrom
mp-c0de:fix/installation-card-scroll-trap
Apr 12, 2026
Merged

fix(docs): allow page scroll to chain past code blocks#24
max-wells merged 1 commit intorust-ui:mainfrom
mp-c0de:fix/installation-card-scroll-trap

Conversation

@mp-c0de
Copy link
Copy Markdown
Contributor

@mp-c0de mp-c0de commented Apr 11, 2026

Summary

Resolves #15.

The overscroll-y-contain Tailwind class on the syntax-highlighted code block components was trapping scroll events. When the cursor was inside an overflowing code block, trackpad momentum got absorbed by the inner element instead of chaining up to the page, leaving the page unscrollable for several seconds (most noticeable in Chrome on macOS, where overscroll-behavior is strictly enforced; Safari is more lenient).

Changes

Removes overscroll-y-contain from two read-only display components:

  • crates/_markdown_crate/src/leptos/components/syntect_highlighter_code.rs:16 — the SyntectHighlighterCode component used for inline code in component docs
  • app_crates/app_components/src/tree_view.rs:130 — the FileRendererHighlight highlighted file viewer in tree views

Why these are safe to change

These two components are passive read-only displays of code. The user's natural intent when scrolling over them is to navigate the docs page, not the code block. Removing overscroll-y-contain restores the browser default of scroll chaining so the page continues scrolling once the code block reaches its boundary.

What is intentionally NOT changed

overscroll-y-contain is left intact in:

  • app_crates/registry/src/ui/sheet.rs:101 — the Sheet modal component, where the trap is the desired behaviour for an interactive overlay
  • app/src/components/shared_sidenav_demos.rs:20 — sidenav demo wrapper, where the panel should scroll independently

Test plan

  • Reproduced the bug in Chrome on macOS — confirmed cursor inside code block trapped scroll for ~5 seconds
  • Built locally with cargo leptos watch
  • Verified after fix: hovering inside the code block and scrolling now scrolls the page once the code block reaches its boundary
  • Verified Sheet component still locks scroll correctly when open
  • Run e2e tests

Resolves rust-ui#15. Removes `overscroll-y-contain` from the syntax-highlighted
code block components used in component documentation pages.

The Tailwind class `overscroll-behavior-y: contain` was preventing scroll
chaining when the cursor was inside an overflowing code block: trackpad
momentum was being absorbed by the inner element instead of bubbling up
to the page, leaving the page unscrollable for several seconds.

Removing it restores the browser's default scroll-chaining behaviour so
the page continues scrolling once the code block reaches its boundary.

Sheet, Drawer, and sidenav demos still keep `overscroll-y-contain`
because they are interactive overlays where the trap is intentional.
Copy link
Copy Markdown
Contributor

@max-wells max-wells left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean and well-reasoned fix — great that you explicitly called out what should NOT be changed (Sheet, sidenav). Thanks @mp-c0de!

@max-wells max-wells merged commit b8de757 into rust-ui:main Apr 12, 2026
@max-wells
Copy link
Copy Markdown
Contributor

Thanks again @mp-c0de — two contributions in two days, appreciate it! 🙌

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.

Can not scroll all page when cursor is inside ## Installation Card

2 participants