Comments fragment identifier has disappeared

Created on 14 January 2016, almost 9 years ago
Updated 8 February 2023, almost 2 years ago

Problem/Motivation

On node teasers, the Comment module adds a few links :

  1. "X comments" which leads to /node/NID#comments but the anchor does not exist in the page ;
  2. "New" (if there are new comments the user didn't read) which leads to /node/NID#new that only works if you only have one comment field => See #2969255: Comments + History "new" link only works with one comment field

Steps to reproduce #1

  1. Install Drupal standard
  2. Create an article with a huge body
  3. Add a comment to this article
  4. Go to the front page and click on the "1 comment" link of your article

Expected: you are redirected to the node page and the browser shows the comment
Current: you are redirected to the node page but the browser show the top of the page

Proposed resolution

Add the field name to the anchor so it becomes "comments--[field-name]".
Add the "comments--[field-name]" id on the comments wrapper.

Remaining tasks

<!-- See https://drupal.org/core-mentoring/novice-tasks for tips on identifying novice tasks. Delete or add "Novice" from the Novice? column in the table below as appropriate. Uncomment tasks as the issue advances. Update the Complete? column to indicate when they are done, and maybe reference the comment number where they were done. -->

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Needs work

Version

10.1

Component
Comment 

Last updated 1 day ago

Created by

🇷🇺Russia Chi

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024