Live data from Hacker News

Why isn't HN infinite scroll?

news.ycombinator.com

11–20 of 44 posts

Re: Why isn't HN infinite scroll?

#11
I say this as a front-end dev who has worked on, among other things, several SPAs

Downsides of infinite scroll:

- Requires JavaScript (adds complexity, especially when site doesn't already require dynamic rendering)

- Loose/unpredictable UX behavior can be discomforting (loads when you don't want it to load, doesn't load when you want it to, scroll bar suddenly changes size, etc)

- Reloading the page/clicking the back button loses your position

- Monotonically-growing DOM slows things down eventually, unless you start de-rendering previous "pages", which adds even more complexity and unpredictability (Ctrl+F doesn't behave as expected, for example)

I think it can make sense for some things, but not for a simple and stable website like HN. Even for something like Twitter I wish they hadn't added it.

Re: Why isn't HN infinite scroll?

#13
Others provide good reasons why it's not in place. But if you want it anyways, here's a snippet you can put in your browser JS console:

    (new IntersectionObserver(v => { if (v[0].isIntersecting) {document.querySelector(".morelink").click()}}, {rootMargin: "0px", threshold: 1})).observe(document.querySelector(".morelink"))
You'd have to rerun the snippet for each page load, so not quite effortless. Throw it into a browser extension content script and you'll get it truly infinite.

Re: Why isn't HN infinite scroll?

#16

I hate infinite scroll. How do you track where you were with infinite scroll? On mobile when rss is smaller infinite websites tend to reset when the web browser clises down, and I have to re scroll half an hour to get to where I were. I had so much bad experience with infinite scroll that I want to curse that whoever invented inf scroll is a P, M and I.

How do you track where you were in paginated HN? Ranking changes between reading a thread and returning to the page and links often swap between pages.

Re: Why isn't HN infinite scroll?

#17

I say this as a front-end dev who has worked on, among other things, several SPAs Downsides of infinite scroll: - Requires JavaScript (adds complexity, especially when site doesn't already require dynamic rendering) - Loose/unpredictable UX behavior can be discomforting (loads when you don't want it to load, doesn't load when you want it to, scroll bar suddenly changes size, etc) - Reloading the page/clicking the bac…

> - Monotonically-growing DOM slows things down eventually, unless you start de-rendering previous "pages", which adds even more complexity and unpredictability (Ctrl+F doesn't behave as expected, for example)

Is this what Twitter is doing? Is this why Ctrl+F almost never works there?

Re: Why isn't HN infinite scroll?

#18
post #17

I say this as a front-end dev who has worked on, among other things, several SPAs Downsides of infinite scroll: - Requires JavaScript (adds complexity, especially when site doesn't already require dynamic rendering) - Loose/unpredictable UX behavior can be discomforting (loads when you don't want it to load, doesn't load when you want it to, scroll bar suddenly changes size, etc) - Reloading the page/clicking the bac…

> - Monotonically-growing DOM slows things down eventually, unless you start de-rendering previous "pages", which adds even more complexity and unpredictability (Ctrl+F doesn't behave as expected, for example) Is this what Twitter is doing? Is this why Ctrl+F almost never works there?

Yeah, I believe so. They pull some additional tricks to keep the scroll bar from going crazy, probably by (I'm guessing) measuring the height of the segments being removed from the DOM and then explicitly padding things to match that size dynamically.

There's a more general principle here where, once you start trying to override core browser behaviors, you usually end up with a never-ending rabbit hole of corner cases that you now have to cover yourself that used to be handled for free (and probably with better performance, and stability, and accessibility...), and an ensuing complexity-explosion in your code. I won't say it's never worth it, but it's something you should really really put a lot of thought into before you go down that road. All other options should be exhausted first.

Re: Why isn't HN infinite scroll?

#20

I say this as a front-end dev who has worked on, among other things, several SPAs Downsides of infinite scroll: - Requires JavaScript (adds complexity, especially when site doesn't already require dynamic rendering) - Loose/unpredictable UX behavior can be discomforting (loads when you don't want it to load, doesn't load when you want it to, scroll bar suddenly changes size, etc) - Reloading the page/clicking the bac…

It is also pretty easy to make infinite scroll an accessibility disaster.
Post reply on HN