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
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).
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 ).
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:
https://github.com/tickinginstant/otwarchive/commit/b1f835bdde1fc72e76a53cd6b11680735e1efd71
Reproduced the problem with works with one of my own on Beta and then checked the behaviour on Test:
turned off JavaScript
logged out and went to https://archiveofourown.org/chapters/1089522?show_comments=true#comments (last chapter of one of my fics on Beta with 3 pages of comments) and https://test.archiveofourown.org/works/109413 (single-chapter work on Test with 2 pages of comments).
clicked on Comments, which took me down to the comments section and added #comments to the URL.
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
news post
Tested with https://archiveofourown.org/admin_posts/13694 on Beta (400+ comments) and https://test.archiveofourown.org/admin_posts/668 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 👍🏻
Work 1 - Put comment box at the top of the page
https://archiveofourown.org/chapters/26858232?show_comments=true#comments
https://archiveofourown.org/chapters/26858232?page=2&show_comments=true#comments
Work 2 - Went to top of page
https://archiveofourown.org/chapters/10278426?show_comments=true#comments
https://archiveofourown.org/chapters/10278426?page=2&show_comments=true
News post - Went to top of page
https://archiveofourown.org/admin_posts/13528?show_comments=true#comments
https://archiveofourown.org/admin_posts/13528?page=2&show_comments=true
Test Work - Put comment box at the top of the page
https://test.archiveofourown.org/chapters/1731507?show_comments=true#comments
https://test.archiveofourown.org/chapters/1731507?page=2&show_comments=true#comments
Test News Post - Put comment box at the top of the page
https://test.archiveofourown.org/admin_posts/668?show_comments=true#comments
https://test.archiveofourown.org/admin_posts/668?page=2&show_comments=true#comments
when paging through this test news post’s comments it jumps to the top of the comments 👍
https://test.archiveofourown.org/admin_posts/668
when paging through this test work’s comments it jumps to the top of the comments 👍
https://test.archiveofourown.org/works/625517