Skip to content

[Bug Report][3.3.3] VInfiniteScroll does not set root element correctly unless margin prop is explicitly supplied #17583

Closed
@eldjh3

Description

Environment

Vuetify Version: 3.3.3
Vue Version: 3.3.4
Browsers: Chrome 114.0.0.0
OS: Mac OS 10.15.7

Steps to reproduce

Use a v-infinite-scroll element without the margin prop. The root is not passed to the IntersectionOberserver which therefore uses the viewport as the root for intersection calculations.

More details

In the linked playground run as-is. It will use the viewport for the root element. It will only load one extra set of data (3 more items) [and get stuck - as per issue 17358]. Resize the viewport such that the intersection div leaves and re-enters the viewport. The infinite scroll will be triggered to load more data.
Comment/uncomment the two v-infinite-scroll tags in the playground. Behaviour changes such that the wrapper div is now correctly the root element. But, no amount of scrolling will now get more data to load.

Expected Behavior

Whether the margin prop is specified or not, the v-infinite-scroll wrapper div is used for the root element.

Actual Behavior

With no explicit margin prop the IntersectionObserver uses the viewport as the root for intersection calculations.

Reproduction Link

https://play.vuetifyjs.com/#...

Other comments

Rather than defaulting to undefined, margin should probably default to zero.

Interestingly, this issue allows a workaround for #17358 as the browser can be resized continually to move the intersection div in and out of the viewport until such time as the loaded content fills the container and naturally pushes the intersection div out of the viewport. At this time the behaviour returns to expected and new content can be loaded simply by scrolling.

Thus, fixing this issue before that issue will prevent that workaround.

Metadata

Assignees

Labels

C: VInfiniteScrollT: bugFunctionality that does not work as intended/expected

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions