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

Description

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: https://test.archiveofourown.org/admin_posts/###?show_comments=true#comments

For a single chapter work, the URL will look like: https://test.archiveofourown.org/works/###?show_comments=true#comments

For a multi chapter work, the URL will look like: https://test.archiveofourown.org/works/###?show_comments=true&view_full_work=true#comments

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. https://test.archiveofourown.org/admin_posts/###?page=2&show_comments=true#comments, 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 https://test.archiveofourown.org/works/704022?show_comments=true&view_full_work=true#comments, following “Proceed” takes you to https://test.archiveofourown.org/works/704022?show_comments=true&view_adult=true&view_full_work=true#comments, 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 ).

Environment

None

Status

Assignee

ticking instant

Reporter

Sarken

Roadmap

Comments

Priority

Medium

Affects versions

Fix versions

Components

FrontEnd

Difficulty

Medium

Required Access Level

None

Milestone

Internal 0.9
Configure