Automattic / Automattic/jetpack

Infinite scroll: Issues with browser back button and Infinity Scrolled page

Open
#17,109 6 comments 1 reaction 1 assignee Claimed by @lancewillett View on GitHub
[Feature] Infinite Scroll [Pri] Normal Bug
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

## Problem

Scrolling the [a8c.tv]() homepage rewrites the URL to `https://a8c.tv/page/NaN`. Clicking a video and pressing back then lands on an unrelated 2017 post instead of returning to the homepage.

Reported by Jesse Friedman in #automattic on March 11, 2026, and reproduced by Kris Karkoski.

## Steps to reproduce

1. Open [https://a8c.tv/]()
2. Scroll down until infinite scroll loads more videos
3. Watch the address bar — it becomes `/page/NaN`
4. Click any video, then press the browser back button

## What happens

* The URL shows `page/NaN` instead of `page/2`.
* Back navigation lands on an arbitrary older post rather than the homepage scroll position.

## Notes from the thread

* Only the **first** pagination step produces `NaN`. Keep scrolling and later pages number correctly, so this looks like an off-by-one or an unset initial page value rather than a general pagination failure.
* A second, milder problem: entering at `/page/5/` and clicking through to a video, then going back, loads only page 5 onward. Earlier pages are never restored, so there is no way to scroll up to more recent videos.
* Kris linked [https://github.com/Automattic/jetpack/issues/17109]() for the back-button half.
* Kris also linked a matching [WordPress.org]() support report for the `NaN` half: [https://wordpress.org/support/topic/im-getting-page-nan-in-url-by-using-infinite-scroll/]()

## Why it is worth fixing

The broken URL escapes the site. On December 8, 2025 someone shared `https://a8c.tv/talk-type/flash-talk/page/NaN/` in Slack as a resource link for flash talks — a link that reads as legitimate and will not do what the next reader expects. Every visitor who scrolls the homepage can hit this, and [a8c.tv]() is the company's primary video archive.

## Suspected area

Jetpack infinite scroll. Worth checking whether the [a8c.tv]() theme's front-page query interacts with the infinite-scroll handler's page counter, since later pages compute correctly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.