Clamp viewport and element scroll offsets after layout when scrollable overflow shrinks
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #1602 by @GoCoder7 — closed without merging
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with BaseDocument::resolve() in packages/blitz-dom/src/resolve.rs and the scroll state in packages/blitz-dom/src/scrolling.rs; the issue identifies layout and transform resolution as the point where updated bounds become available. Trace how viewport and element offsets, including in-flight animation targets, relate to those bounds. Done means offsets and animation targets stay within the updated range, with collapsed or non-scrolling containers reset as described. A pull request is already linked.
Written by the indexing model from the issue text.
Description
Problem Summary
When scrollable overflow shrinks due to DOM mutations, style changes, or viewport resizing, Blitz Native leaves both viewport (viewport_scroll) and element (node.scroll_offset) scroll offsets at their previous positions instead of clamping them against the updated post-layout scrollable bounds.
This causes rendered views to remain translated past their maximum scroll boundary, pushing visible content off-screen and leaving blank empty strips at the bottom or right edges of the window or container.

Concrete Reproduction & Observed Metrics
- Open a window with a
1027px-tall viewport rendering a scrollable view of height1166px. - Scroll to the bottom of the page:
viewport_scrollreaches(0.0, 139.0). - Trigger a DOM mutation or navigation that changes the rendered content to a shorter view of height
480px. - The root layout height shrinks to fit the viewport (
1027px), wheremax_scroll.y == 0.0. - However,
viewport_scrollremains at(0.0, 139.0). - During painting in
blitz-paint(packages/blitz-paint/src/render.rs), the root layer continues applying a translation of-139pxalong the Y axis. Top content is pushed off the top of the viewport, leaving a139pxblank strip at the bottom of the window (as illustrated in the comparison screenshot above against Web behavior).
The same behavior occurs for element-level scroll containers (overflow: auto / overflow: scroll) when their child elements are removed or shrink in size.
Root Causes in blitz-dom
- Missing Post-Layout Clamping in
BaseDocument::resolve():
BaseDocument::resolve()(packages/blitz-dom/src/resolve.rs) invokesresolve_layout()andresolve_transforms()(which updatesscrollable_overflowatresolve.rs:248), but never clampsviewport_scrollor elementnode.scroll_offsetafterwards before building the paint tree or performing hit-testing. - Premature Viewport Clamping during Device Change Flushing:
BaseDocument::flush_pending_device_changes()(packages/blitz-dom/src/document.rs:2930) callsself.scroll_viewport_by(0.0, 0.0)atresolve.rs:79beforeresolve_stylist()(L82) andresolve_layout()(L118). As a result, viewport resize events clamp against stale pre-resize dimensions, while DOM or stylesheet mutations skip clamping entirely. - Unclamped In-Flight Smooth Scroll Animations:
In-flightScrollAnimationState::ScrollTo(packages/blitz-dom/src/scrolling.rs) retains unclampedstartandendtarget offsets if scrollable overflow shrinks mid-animation, causing animation ticks to drive scroll offsets beyond the new bounds.
Expected Behavior
In accordance with CSS Overflow Module Level 3 and CSSOM View specifications:
- After layout and transform resolution, both the viewport and all element scroll containers must clamp their scroll offsets to the updated
[min, max]scroll range. - Containers transitioning to non-scrolling overflow (
overflow: visible | clip) or boxless states (display: none,display: contents) should reset their scroll offset to(0.0, 0.0). - Active smooth scroll animations should have their
startandendtargets clamped to the updated[min, max]range (or be cancelled if collapsed).
- Dominant language
- Rust
- Stars
- 4.5k
- Forks
- 281
- Avg merge
- 6h 6m
- Merged PRs (30d)
- 184
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DioxusLabs/blitz
-
<input type="number"> misses text-entry leaf sizing in layoutPossibly taken @GoCoder7 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
DioxusLabs/blitz#1675 ·
Maintainers usually reply within 1 day
-
Copy, cut and paste shortcuts don't work with Caps Lock or ShiftPossibly taken @nicoburns claimed this 8 days ago. OpenA-Events C-Bug
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
DioxusLabs/blitz#1507 ·
Maintainers usually reply within 1 day
-
Copy and cut work in password inputsPossibly taken @nicoburns claimed this 8 days ago. OpenA-Events A-Forms C-Bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DioxusLabs/blitz#1501 ·
Maintainers usually reply within 1 day
-
Panic on live viewport resize when unstyled elements exist in display: none subtreePossibly taken @GoCoder7 claimed this 9 days ago. OpenA-Layout A-Style C-Bug I-Crash
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
DioxusLabs/blitz#1488 ·
Maintainers usually reply within 1 day
-
Right-button drag starts a text-selection drag and suppresses `contextmenu`Possibly taken @staging-devin-ai-integration claimed this 24 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
DioxusLabs/blitz#1184 ·
Maintainers usually reply within 1 day
All issues in DioxusLabs/blitz
Similar issues
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
pbakaus/impeccable#1601 ·
Maintainers usually reply within 1 day
-
RDF/XML writer: a blank node in two lists is left out of the secondPossibly taken @mrnolte claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
phillord/horned-owl#368 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mongodb/kingfisher#588 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug rust
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days