Infinite scroll in collection item lists

hi, have you considered infinite scroll for item lists (in the gutenberg blocks, default views etc)?

inspiration: for our main collections site at the Nordic Museum, there’s a “Show more results” button to begin with (after the first 20 results), but after that additional items are loaded as you scroll. It’s a nice compromise between initial page load & presenting lots of items.“S-NM”

Hi @AronAmbrosiani!

Yesss we have discussed it more than once. There are some things that step in my way:

1- For Gutenberg Blocks, they could be in any place on the page, even in different layouts, which makes complicated to detect that the page scroll “reached the end” of the list. I’ve done some experiments with Intersection Observer API - Web APIs | MDN, which makes it possible;
2 - For the Items List itself (the faceted search, with filters, etc) there is a similar issue as themes might use it in different templates, but the most complicated part is to adapt the pagination logic. Nowadays we use perpage and paged attributes from the WP Query API. But we can adapt it to use offset and count rather easily… the problem is that our “store”, where we keep the items locally after loaded (and clean them after filtering, changing order, etc) is really not prepared to handle the cumulative way that the infinite scroll works. I’ve thought about making this a property bound to the “view mode”, as the “fullscreen/slideshow” view mode existing today kinda does this cumulative strategy, but it is a bit buggy, the way it is working so far…

That said (here I am giving excuses), it is a really nice feature (the Nordic Museum page is a really nice example) and I hope to have the opportunity to implement it one day, it is really just a bit far in our priorities :sweat_smile:

1 Like

thanks for the detailed answer and no worries, I’m really impressed by the pace of development and all the features and fixes that are implemented. I agree that this should be a low priority item :slight_smile:

hopefully I will be able to contribute a bit more to the codebase eventually and not just offer ideas and bug reports!

No worries as well, even the ideas and bug reports are more than welcome and have been really useful this whole year :innocent:.

Let’s open an issue to keep the candles lit :crossed_fingers:t3: