Arv/no space yes content wrapper#48
Merged
Merged
Conversation
…ed scrolling behavior
…for dynamic content growth
There was a problem hiding this comment.
Pull request overview
This PR refactors the virtualized list rendering model from top/bottom spacer elements to a single content wrapper that uses paddingTop / paddingBottom (spaceBefore / spaceAfter), and updates stick-to-bottom behavior to be driven by DOM observation (ResizeObservers) rather than framework-provided “content deps”.
Changes:
- Replace “spacers” with a padded content wrapper across core docs, demos, and tests.
- Rework stick-to-bottom (core + React + Solid bindings) to lazily wire DOM observers and remove explicit content-growth dependency plumbing.
- Add/adjust unit + e2e tests to validate DOM-driven stick-to-bottom behavior and updated “space” semantics.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/solid/create-zero-virtualizer.test.ts | Updates test wording to match padding-based “spaceAfter” semantics. |
| src/solid/create-stick-to-bottom.ts | Removes explicit deps and relies on DOM-driven attachment. |
| src/react/use-zero-virtualizer.ts | Updates public docs to describe wrapper padding model. |
| src/react/use-zero-virtualizer.test.ts | Updates tests for wrapper-based stick-to-bottom + adds ResizeObserver stubbing. |
| src/react/use-stick-to-edge.ts | Removes explicit deps and wires stick-to-bottom per commit. |
| src/core/virtualizer.ts | Adjusts anchoring/hold behavior to target content wrapper; updates docs/comments. |
| src/core/virtualizer.test.ts | Renames/updates snapshot test descriptions for “space” terminology. |
| src/core/types.ts | Updates anchoring mode docs for wrapper-margin hold behavior. |
| src/core/stick-to-bottom.ts | Replaces content-change API with DOM-driven ensure() and ResizeObserver wiring. |
| src/core/index.ts | Exports contentWrapper and removes contentGrowthDeps. |
| src/core/dom.ts | Introduces contentWrapper() helper and updates related docs. |
| README.md | Updates usage examples and documentation to wrapper-padding + DOM-driven stick-to-bottom. |
| demo/solid/ItemRow.tsx | Removes spacer component from Solid demo. |
| demo/solid/App.tsx | Switches Solid demo rendering to wrapper padding. |
| demo/shared/App.module.css | Removes spacer styles now that spacers are gone. |
| demo/react/WindowList.tsx | Switches window-scroller demo to wrapper padding. |
| demo/react/list-shared.ts | Updates docs/comments from “spacers” to “space estimates/padding”. |
| demo/react/ItemRow.tsx | Removes spacer component from React demo. |
| demo/react/e2e/tests/stick.spec.ts | Adds e2e coverage for DOM-driven stick-to-bottom on wrapper growth. |
| demo/react/e2e/tests/scroll.spec.ts | Updates wording from “spacer” to “padding” in assertions/comments. |
| demo/react/App.tsx | Switches React demo rendering to wrapper padding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+108
to
+124
| scrollTarget.addEventListener('scroll', measure, {passive: true}); | ||
| const observer = new ResizeObserver(repin); | ||
| observer.observe(content, {box: 'border-box'}); | ||
| let removeWindowResize: (() => void) | null = null; | ||
| if (scroller === document.scrollingElement) { | ||
| // A ResizeObserver on the scrolling element tracks the document (its | ||
| // content), not the viewport — use the window resize event instead. | ||
| window.addEventListener('resize', repin); | ||
| removeWindowResize = () => window.removeEventListener('resize', repin); | ||
| } else { | ||
| observer.observe(scroller, {box: 'border-box'}); | ||
| } | ||
| cleanup = () => { | ||
| scrollTarget.removeEventListener('scroll', measure); | ||
| observer.disconnect(); | ||
| removeWindowResize?.(); | ||
| }; |
Comment on lines
+169
to
+172
| () => { | ||
| const scroller = virtualizer.scrollElement; | ||
| return scroller && contentWrapper(scroller); | ||
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.