Comment pagination sometimes jumps back to top of page on works, always does so on news posts


You'll need a work and a news post with two or more pages of comments, and you'll need to load those comments without JavaScript.

For a news post, the URL will look like:

For a single chapter work, the URL will look like:

For a multi chapter work, the URL will look like:

What should happen

When you use the pagination to navigate between pages of comments, the page that is loaded should have a comments anchor on the end of its URL, e.g., which should position the comment form at the top of the screen (or the kudos section, if you’re using a work).

What does happen

In reality, this never appears to happen with news posts. It sometimes appears to happen with works.

Tested while logged in, with preferences set to show full work by default and not to warn for adult content. It seems more likely to keep the anchor on works rated Explicit, Mature, or Not Rated, but I am not 100% sure that is the key. redsummernight notes that if they access a work while logged out and have to navigate past the adult content warning, the comments anchor is lost on the pagination (i.e. if you start at, following “Proceed” takes you to, and then the anchor disappears when following one of the pagination links.)

Just to reiterate, this only applies when loading comments via the URL parameters, not AJAX. That has its own issues ( AO3-5204 ).


September 10, 2019, 6:41 PM

when paging through this test news post’s comments it jumps to the top of the comments 👍

when paging through this test work’s comments it jumps to the top of the comments 👍

September 10, 2019, 10:37 AM

news post
Tested with on Beta (400+ comments) and on Staging.
On Beta, loading page 2 of the comments without JavaScript reloads the page without the #comment fragment. On Staging, page 2 loads with the fragment and the browser correctly scrolls down to the top of the comments.

All looks good to me 👍🏻

September 10, 2019, 8:27 AM

Reproduced the problem with works with one of my own on Beta and then checked the behaviour on Test:

  1. turned off JavaScript

  2. logged out and went to (last chapter of one of my fics on Beta with 3 pages of comments) and (single-chapter work on Test with 2 pages of comments).

  3. clicked on Comments, which took me down to the comments section and added #comments to the URL.

  4. Navigate to page 2 of the comments. On Beta, the #comment anchor link disappeared from the URL, and I was back at the top of the page. On Test, the anchor remains and when the page refreshes, the browser skips to the comments section so this checks out for works. 👍🏻

Still need to test news posts next

ticking instant
December 30, 2018, 12:17 AM

I think this is probably the right fix, but I already have more PRs than I’m comfortable with, so I don’t want to submit another one right now:



ticking instant







Affects versions

Fix versions






Internal 0.9