In Drupal 7 and earlier, the only indication of comment parent/child relationships is the visual indentation (or "nesting") of child comments, and the information is not available to screen readers. For better accessibility, Drupal 8 introduces a $parent
template variable that includes the title and poster of the parent comment on each comment, e.g.:
In reply to <a href="/comment/13#comment-13">Example Comment</a> by <a href="/user/5" title="View user profile.">Example user</a>
Themes that override the comment template should print this variable to ensure that comment nesting is accessible to screen readers. The text can either be displayed to all users (similarly to the "submitted by" information) or hidden with the element-invisible
CSS class.
Example
To print the accessible link in your mytheme
comment template, add the following to mytheme/templates/comment.tpl.php
:
<?php
// Indicate the semantic relationship between parent and child comments
// for accessibility. The list is difficult to navigate in a screen
// reader without this information.
if ($parent):
?>
<p class="comment-parent element-invisible">
<?php print $parent; ?>
</p>
<?php endif; ?>