Problem/Motivation

Follow-up to #2228763: Create a comment-type config entity and use that as comment bundles, require selection in field settings form. At the moment the comment form heading always says "Add new comment" on the form. If you have a specific comment type like "Greeting" you probably want it to say "Write greeting" instead.

Proposed resolution

This proposed resolution comes from the UX committee. See Comment 104 for details.

Add a Form heading field on the Comment field settings form of an entity. eg: Structure > Content Types > Article Manage fields > Comments or /admin/structure/types/manage/article/fields/node.article.comment.

Include the help text, "This text will be displayed as the heading of the comment form, if the theme supports it."

Place the Form heading field after the Comment field's Help text

Proposed resolution mockup

Mockup of new comment field settings form.

Remaining tasks

  1. ❌ Get Comment Module maintainer (larowlan, andypost) approval of the proposed resolution.
  2. ❌ Implement proposed resolution
  3. ❌ Add hook_update_n() implementation to update all existing comment types
  4. ❌ Write test coverage for merge request
  5. ❌ Write change record.
  6. ❌ Commit to Drupal core
  7. ❌ Celebrate the ability to now change the comment form heading through the Drupal admin UI. 🥳

User interface changes

New setting on the field.

API changes

Likely none. Config schema is expanded.

Data model changes

Config is expanded.

CommentFileSizeAuthor
#104 comment_field.png138.88 KBrkoller
#102 bartik.png55.62 KBrkoller
#102 olivero.png295.26 KBrkoller
#96 interdiff-2546116-94-96.txt1003 bytesyogeshmpawar
#96 2546116-96.patch16.96 KByogeshmpawar
#94 interdiff-2546116-93-94.txt2.21 KByogeshmpawar
#94 2546116-94.patch16.96 KByogeshmpawar
#93 2546116-93.patch16.05 KBravi.shankar
#88 interdiff-86-2546116.txt5.13 KBvakulrai
#87 interdiff-86-2546116.txt1.45 KBvakulrai
#86 comment_header_coiguration-2546116-86.patch16.05 KBvakulrai
#85 interdiff-85-2546116.txt1.45 KBvakulrai
#85 comment_header_coiguration-2546116-85.patch16.05 KBvakulrai
#84 interdiff-2546116-84.txt4.76 KBvakulrai
#84 comment_header_coiguration-2546116-84.patch15.97 KBvakulrai
#81 interdiff_2546116_79-81.txt1.49 KBankithashetty
#81 2546116-81.patch10.92 KBankithashetty
#79 reroll_diff_2546116_70-79.txt5.73 KBankithashetty
#79 2546116-79.patch10.39 KBankithashetty
#70 2546116-comments-heading-70.patch11.14 KBandypost
#70 interdiff.txt795 bytesandypost
#69 2546116-comments-heading-69.patch9.89 KBandypost
#69 interdiff.txt982 bytesandypost
#68 2546116-comments-heading-68.patch10.35 KBandypost
#68 interdiff.txt1.63 KBandypost
#63 2546116-comments-heading-63.patch9.02 KBmortona2k
#58 2546116-comments-heading-58.patch9.04 KBandypost
#58 interdiff.txt3.72 KBandypost
#55 you_can_add_a_review-2546116-55.patch7.1 KBbalintcsaba
#51 you_can_add_a_review-2546116-50.patch7.09 KBbalintcsaba
#45 comment_advanced.tar_.gz2.35 KBdawehner
#39 Test content | drupal 8.0.0-rc2 2015-10-22 20-43-37.png146.04 KBgábor hojtsy
#33 Comments settings for Article | drupal 8.0.0-rc2 2015-10-22 13-16-15.png271.38 KBgábor hojtsy
#25 you_can_add_a_review-2546116-25.patch6.08 KBmirom
#25 interdiff-2546116-18-25.txt611 bytesmirom
#18 you_can_add_a_review-2546116-18.patch6.07 KBmirom
#18 interdiff-2546116-14-18.txt604 bytesmirom
#17 interdiff-2546116-14-17.txt2.29 KBmirom
#17 you_can_add_a_review-2546116-17.patch7.91 KBmirom
#14 interdiff-2546116-13-14.txt426 bytesmirom
#14 you_can_add_a_review-2546116-14.patch6.07 KBmirom
#13 you_can_add_a_review-2546116-13.patch6.07 KBmirom
#9 you_can_add_a_review-2546116-9.patch6.55 KBmirom
#6 you_can_add_a_review-2546116-6.patch5.94 KBmirom

Issue fork drupal-2546116

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Gábor Hojtsy created an issue. See original summary.

andypost’s picture

Also we always get this link on node page

andypost’s picture

larowlan’s picture

Agreed

mirom’s picture

Assigned: Unassigned » mirom
Issue tags: +Drupalaton 2015
mirom’s picture

StatusFileSize
new5.94 KB

@TODO: Translations

@GaborHojtsy - can you please explain `1) the list heading (defaults to "Comments")` little bit more, I think, this is field setting.

mirom’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: you_can_add_a_review-2546116-6.patch, failed testing.

mirom’s picture

StatusFileSize
new6.55 KB

Fixed error from test.

mirom’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: you_can_add_a_review-2546116-9.patch, failed testing.

gábor hojtsy’s picture

Issue summary: View changes

@miro: yeah I copied that text over mostly from @dixon's notes from the other issue. It is a field setting indeed, no need to work on that one :) Updated the summary.

mirom’s picture

Status: Needs work » Needs review
StatusFileSize
new6.07 KB

Error was in missing form_heading in Comment test suite even when it was failing on Search module test.

mirom’s picture

StatusFileSize
new6.07 KB
new426 bytes

Enabling translation for Form heading property.

rteijeiro’s picture

Status: Needs review » Needs work

Thanks for the patch @mirom. Just spotted a few nits. Could you fix them, please?

  1. +++ b/core/modules/comment/src/CommentTypeInterface.php
    @@ -33,6 +33,24 @@ public function getDescription();
    +   * @return $this
    

    Missing return description?

rteijeiro’s picture

Sorry, this nit was missing in previous comment.

+++ b/core/modules/comment/src/CommentTypeForm.php
@@ -101,6 +101,13 @@ public function form(array $form, FormStateInterface $form_state) {
+      '#default_value' => empty($comment_type->getFormHeading())?'Add new comment':$comment_type->getFormHeading(),

Missing spaces.

mirom’s picture

StatusFileSize
new7.91 KB
new2.29 KB

Fixing whitespace errors.

mirom’s picture

StatusFileSize
new604 bytes
new6.07 KB
mirom’s picture

Status: Needs work » Needs review
rteijeiro’s picture

Assigned: mirom » Unassigned
Status: Needs review » Reviewed & tested by the community

I think testbot will like the patch so it's RTBC for me. Checked with @mirom in Drupalaton :)

Great job!

dawehner’s picture

Status: Reviewed & tested by the community » Needs review

@xano and @dawehner have been wondering whether instead of using a configuration we could pass along the context to the t() call depending on the comment type.
This then would allow you to translate it per context, or?

mirom’s picture

What should be context in this case? I see configuration more clear then context translation.

mirom’s picture

Status: Needs review » Reviewed & tested by the community

Gabor says, the proposal in #21 is hack, so back to RTBC.

zserno’s picture

Status: Reviewed & tested by the community » Needs work

Almost there, good job @mirom!
I found one small thing:

+++ b/core/modules/comment/src/CommentTypeForm.php
@@ -101,6 +101,13 @@ public function form(array $form, FormStateInterface $form_state) {
+      '#default_value' => empty($comment_type->getFormHeading()) ? 'Add new comment' : $comment_type->getFormHeading(),

The static text 'Add new comment' should be wrapped in t().

mirom’s picture

Status: Needs work » Needs review
StatusFileSize
new611 bytes
new6.08 KB

Thanks @zserno, fixed.

gábor hojtsy’s picture

Just to clarify what @mirom said about my feedback, if all the field on comments are configurable on the field UI with their labels, and the label on the list of comments itself is configurable on the parent entity you attach them to, then putting the "Add new comment" string at an entirely different place to the interface translation would not work very well for usability. Also, it would not let you set up different text for different field instances, say if you have comments of type "Review" and comments of type "Greeting" then both need their own setting for "Add new review", "Add new greeting". While you could generate the t() context dynamically to allow for that, that is an even bigger hack, we don't do anything even remotely similar that I am aware at other places in core.

david.lukac’s picture

Works for me with the latest patch. RTBC+1
D

mirom’s picture

gábor hojtsy’s picture

Issue tags: +Drupalaton 2015

I see no reason to change history on this. It was worked on at Drupalaton 2015, lets keep it.

joelpittet’s picture

Assigned: Unassigned » webchick
Issue tags: +Needs product manager review
+++ b/core/modules/comment/src/CommentTypeForm.php
@@ -101,6 +101,13 @@ public function form(array $form, FormStateInterface $form_state) {
+      '#title' => t('Form heading'),
...
+      '#default_value' => empty($comment_type->getFormHeading()) ? t('Add new comment') : $comment_type->getFormHeading(),

These can use the injected t(). aka: $this->t()

This likely needs to be pushed to 8.1.x since we've past RC. Assigning to webchick for product feedback.

joelpittet’s picture

Category: Bug report » Feature request

Also this is not a bug, this a feature request. You can change that text through Translation in settings.php and by extending the template. This is a site builder feature request

Bojhan’s picture

Status: Needs review » Closed (won't fix)
Issue tags: -Needs product manager review

We shouldn't do these type of settings through the UI. Submissions is a completely different type of setting, as thats about supplying guidelines.

I am going to won't fix this, we don't do this through the UI no point in starting to do that now (especially not as a one-off).

gábor hojtsy’s picture

Version: 8.0.x-dev » 8.1.x-dev
Category: Feature request » Bug report
Issue summary: View changes
Status: Closed (won't fix) » Needs work
Issue tags: -rc deadline
StatusFileSize
new271.38 KB

@Bojhan: here is a simple way to explain the problem. I'd even say its at least a normal bug. If I can change the label of the listing of comments however I want but not how the input of them is presented, that is a problem. I can change all the labels and types of elements on the form however I want, I can make it a guest book or a review form but can never change the title of the form.

I also don't agree this is an RC deadline, we'll definitely need to move to 8.1 though. Such changes are not allowed in 8.0 anymore.

gábor hojtsy’s picture

@joelpittet: the reason this is a bug is "translating" the "Add new comment" string to something else does not apply on a comment type level while the "Comments" label configuration does. Either way I don't think the category matters, given its not possible to do in Drupal 8.0.0 and both categories may be possible in 8.1.0.

Bojhan’s picture

@Gábor How do we deal with this in other places? We don't offer this type of configurability for other types of UI facing elements that are module provided right? Only for fields. And this is not like a "field group" its a special legacy thing, from the old days.

I would argue that first setting is even worrisome. I saw your twitter message, and I think the whole point of our theme system is to go to the template files when you have to change things like that. We shouldn't have a UI for every user facing string (unless its translation), only the "flexible" parts.

At the very least we should have a standard, not one-offs.

Bojhan’s picture

Category: Bug report » Feature request

What is broken here? Nothing. The fact that we have a one-off for one user interface element, does not necessarily constitute it also being there for the 2nd one. I feel like we discussed this particular feature before, and decided that the usecase for the 2nd one was ever so small.

This is adding a "thing" not about making it more consistent, because we don't have a pattern for this in core.

webchick’s picture

Assigned: webchick » Unassigned

To me, the screenshot / description in #33 is definitely describing a bug. However, I agree with Bojhan that adding a UI setting for that particular piece of text feels very odd. As opposed to simply putting in the twig file:

<h2>Add new {{entity.label}}</h2>

...or whatever.

That would solve the crux of this issue, without presenting new and confusing, one-off UI options.

Bojhan’s picture

Category: Feature request » Bug report

Ok ok :) Sorry for moving this about so much.

gábor hojtsy’s picture

@Bojhan: I don't agree at all that the existing "Comments" configurability is a one-off. When I fill in the tags field the little "Tags" label shows up above the list of tags. When I add a field, its label shows up above the field value (in this screenshot a boolean field on whether its a feature or bug :P). Comments are a field. The "Comments" label shows up above the comments. Same as with tags or any other field I added. I think thats straightforward. It makes total sense and follows a pattern. HOWEVER, comments also emit another label with the same level header markup that is not configurable like the initial label. This kind of label indeed does not appear with any of the other core fields that I know. (That the "Comments" and "Add new comment" labels somehow show up on a different importance level / scale compared to the feature or bug field is not surprising, the tags field is also differently styled according to its role in the content).

@webchick: not sure using the type name of the comment type (I assume based on your suggestion) would suffice, the "Comments" label is independently configurable of the comment type. It would be odd to still not need to add a comment type for changing the "Comments" label but to need to add a comment type to be able to change the "Add new comment" label.

mirom’s picture

@Gabor - what do we still need to fix in this issue? Should it go back to RTBC and be commited into 8.1.0?

andypost’s picture

As I said in #1 we also need to take care about node links (maybe separate issue) because now there's a bug - "Add new comment" link is always displayed (in teaser and full node view).
We should be able to configure node link too!

The only thing I'm not sure here is a usage of comment type to store this data.
Comment types are not about fields, they are about comment relation to commented entity!
So I think that field (or field storage) setting is most suitable for that because formatter and comment form are bound to the field not the comment type.

@mirom This could be accepted only as a part of 8.1 and later, and this needs hook_update_n() implementation to update all existing comment types.

  1. +++ b/core/modules/comment/comment.module
    @@ -763,6 +763,10 @@ function comment_preprocess_field(&$variables) {
    +    $comment_type = CommentType::load($variables['comment_type']);
    +    $variables['form_heading'] = $comment_type->getFormHeading();
    

    I'd like to get rid of entity loading in preprocess

  2. +++ b/core/modules/comment/src/CommentTypeForm.php
    @@ -101,6 +101,13 @@ public function form(array $form, FormStateInterface $form_state) {
    +      '#title' => t('Form heading'),
    ...
    +      '#default_value' => empty($comment_type->getFormHeading()) ? t('Add new comment') : $comment_type->getFormHeading(),
    
    +++ b/core/profiles/standard/config/install/comment.type.comment.yml
    @@ -2,5 +2,6 @@ id: comment
    +form_heading: 'Add new comment'
    

    $this-t() should be used in forms

    and there's no reason for empty() check - default value should be provided by comment type entity (as standard profile does)

larowlan’s picture

Agree with @andypost on this - we want to make these (plugin based) formatter settings in #2377849: Simplify what CommentLinkBuilder is doing - consider removing a lot of the functionality so it would align with that.

wim leers’s picture

Do we even need the Add new comment? Can't we simply remove it?

tkoleary’s picture

@wim leers

Do we even need the Add new comment? Can't we simply remove it?

IMO we do not need it. The "comment" label over the text area is sufficient.

While we're at it we really don't need "subject" either. :)

dawehner’s picture

StatusFileSize
new2.35 KB

If you have multiple comment types on the page, which is a total usecase, dropping those labels makes the situation just worse.

Note, this small module was needed to make a page with two comment types usable. There are other places like the entity edit form, which has similar problems.

wim leers’s picture

While we're at it we really don't need "subject" either. :)

Indeed. But there's a separate issue for that already: #2312329: Hide the comment "subject" field by default.

If you have multiple comment types on the page, which is a total usecase, dropping those labels makes the situation just worse.

But then you still have the "comment type" label?

We'd just change from this:

Comments
…
…
Add new comment
[FORM]

Product Feedback
…
…
Add new comment
[FORM]

to this:

Comments
…
…
[FORM]

Product Feedback
…
…
[FORM]

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

greg.b’s picture

Is this bug going to be fixed?

As it stands if you have 2+ comment forms on a page you cant label them? Such a simple thing is expected from a UI/UX perpective?

:)

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

balintcsaba’s picture

Issue summary: View changes
Issue tags: -Drupalaton 2015 +Drupalaton

updating issue summary based on review with YesCT @Drupalaton 2016
will try to do the remaining tasks tomorrow

balintcsaba’s picture

Status: Needs work » Needs review
StatusFileSize
new7.09 KB

Status: Needs review » Needs work

The last submitted patch, 51: you_can_add_a_review-2546116-50.patch, failed testing.

The last submitted patch, 51: you_can_add_a_review-2546116-50.patch, failed testing.

gábor hojtsy’s picture

Issue tags: +Drupalaton 2015

I don't think keeping the old tag will do any harm(?)

balintcsaba’s picture

Status: Needs work » Needs review
StatusFileSize
new7.1 KB

Status: Needs review » Needs work

The last submitted patch, 55: you_can_add_a_review-2546116-55.patch, failed testing.

balintcsaba’s picture

andypost’s picture

Issue tags: -Drupalaton 2015, -Drupalaton +Drupalaton 2015 Drupalaton, +Needs tests, +D8 upgrade path
StatusFileSize
new3.72 KB
new9.04 KB

Here's some templates cleanup and

+++ b/core/modules/comment/src/CommentTypeForm.php
@@ -95,6 +95,13 @@ public function form(array $form, FormStateInterface $form_state) {
+      '#default_value' => $this->t($comment_type->getFormHeading()),

Fixed translatable config usage

This needs upgrade path

andypost’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 58: 2546116-comments-heading-58.patch, failed testing.

gábor hojtsy’s picture

Issue tags: -Drupalaton 2015 Drupalaton +Drupalaton 2015, +Drupalaton

Fix tags that @andypost inadvertently broke in #58.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mortona2k’s picture

StatusFileSize
new9.02 KB

I rerolled the patch, but I don't see the form header appearing.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

anas_maw’s picture

Patch in #63 worked for me

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new1.63 KB
new10.35 KB

reroll + fix for tests

andypost’s picture

StatusFileSize
new982 bytes
new9.89 KB

Cleaner default value

andypost’s picture

StatusFileSize
new795 bytes
new11.14 KB

Add update hook & fix forum default config

andypost’s picture

Status: Needs review » Needs work
Issue tags: -D8 upgrade path +KharkivCS

Still needs work to extend tests & upgrade path tests

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

nick hope’s picture

I installed the patch in #70 over Drupal 8.7.3 using Composer. When I then ran update.php I got a white screen with this error:

Fatal error: Cannot redeclare comment_update_8701() (previously declared in C:\Users\Nick\Sites\seelife\web\core\modules\comment\comment.install:255) in C:\Users\Nick\Sites\seelife\web\core\modules\comment\comment.install on line 274

But the site still functioned and I was able to remove the patch and successfully run update.php.

Perhaps I need to reverse some of my site's comments configuration before applying the patch and running update.php, but I'm not sure what.

In the meantime I achieved it by commenting out the "Add new comment" line in a custom template, per Shawn Conn's answer here.

andypost’s picture

Yep, it should be post update hook instead of hook update

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

andypost’s picture

Issue tags: +Needs reroll
ankithashetty’s picture

Issue tags: -Needs reroll
StatusFileSize
new10.39 KB
new5.73 KB

Hi @andypost, rerolled the patch in #70. The changes made in core/modules/comment/comment.install is not included in the rerolled patch. After the changes made in #3087644: Remove Drupal 8 updates up to and including 88**, I am not sure how to go about it...

andypost’s picture

@ankithashetty Thank you! the update hook needs re-work using hook_post_update_NAME() ref https://www.drupal.org/node/2563673

+++ b/core/modules/comment/comment.install
@@ -220,3 +220,14 @@ function comment_update_8700() {
+function comment_update_8701() {
+  $config_factory = \Drupal::configFactory();
+  foreach ($config_factory->listAll('comment.type.') as $type_name) {
+    $type = $config_factory->getEditable($type_name);
+    $type->set('form_heading', 'Add new comment')->save(TRUE);
+  }
+}

this hunk should go to comment.post_update.php as it changing config (doing upgrade)

As example you could use views_post_update_field_names_for_multivalue_fields()

ankithashetty’s picture

Status: Needs work » Needs review
StatusFileSize
new10.92 KB
new1.49 KB

Hey @andypost, thank you for all the references... I updated the patch as per your suggestions and fixed the custom failure errors in #79, kindly review.

andypost’s picture

Issue tags: +Needs upgrade path tests

Looks great! It still needs additional tests for new functionality and test for upgrade hook

Status: Needs review » Needs work

The last submitted patch, 81: 2546116-81.patch, failed testing. View results

vakulrai’s picture

Status: Needs work » Needs review
StatusFileSize
new15.97 KB
new4.76 KB

Adding a patch with test that will verify the functionality of new configurations and also made some changes in code/themes/bartik and core/theme/seven for comment field which were missed.

vakulrai’s picture

Changes invalid username issue in the previous patch and corrected unequal array in test.

vakulrai’s picture

StatusFileSize
new16.05 KB

Updated coding standards.

vakulrai’s picture

StatusFileSize
new1.45 KB
vakulrai’s picture

StatusFileSize
new5.13 KB

Status: Needs review » Needs work

The last submitted patch, 86: comment_header_coiguration-2546116-86.patch, failed testing. View results

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

Version: 9.3.x-dev » 9.4.x-dev
Category: Bug report » Task
andypost’s picture

The issue is a feature, but I see more like UX now

ravi.shankar’s picture

StatusFileSize
new16.05 KB

Added reroll of patch #86 on Drupal 9.4.x.

yogeshmpawar’s picture

Status: Needs work » Needs review
StatusFileSize
new16.96 KB
new2.21 KB

Updated patch will fix test failures & added an interdiff as well.

Status: Needs review » Needs work

The last submitted patch, 94: 2546116-94.patch, failed testing. View results

yogeshmpawar’s picture

Status: Needs work » Needs review
StatusFileSize
new16.96 KB
new1003 bytes

Hope this will fix test failure.

Status: Needs review » Needs work

The last submitted patch, 96: 2546116-96.patch, failed testing. View results

catch credited diqidoq.

catch credited joachim.

catch’s picture

Marked #2978209: Replace hard coded Add new comment in field--comment.html.twig as duplicate and moving credit over here.

rkoller’s picture

StatusFileSize
new295.26 KB
new55.62 KB

I became aware of the issue when @andypost mentioned on the #bugsmash channel that there is the need of an ux review for a while. I've applied that patch to a Drupal 9.4.x install yesterday night and ran into a possible issue i am not quite sure if it is rooted in this patch, if it is a separate Olivero issue or if it is simply based on a configuration mistake of mine. I've agreed with @andypost to comment with the infos i've previously posted in the Slack chat. and when the point about Olivero (1.) is figured out i will propose the issue for the weekly UX meeting that more pair of eyes and perspectives take a look at the issue. I am not comfortable to remove a needs usability review tag on my own and anyway it is always better to have more people with different perspectives and background discuss the issue. about the points i've noticed.

1. I've used Claro as the admin theme and Olivero as the front end theme when setting up a comment type. For the Form heading i've used Add a new thought while i've used Your thoughts as the label for the comment field in the article content type and You add your thought in the comment field as the help text. I've then created an article and added a new comment called my very first comment with test in the body. but the visual representation is confusing:

three browser windows next to each other with comment type edit screen, comment field in the article content type and the visual representation of comments of an article node in olivero

First comes the title Your thoughts , then the new comment entry form missing the Add a new thought form heading and then the list of comments. Also the help text isn't shown anywhere? ( I am not sure if that is the expected behaviour in regards of the help text).
I've then switched with the same configuration to Bartik. The output looks like that now:

screenshot of the same comments section like before but in bartik

the comment entry form is correctly showing the set title and the order is different (in a way i'Ve expected). but the help text is missing there as well.

so is it possible that for Olivero the comment entry form title has to be added to the twig file as well? and is the positioning of the comment entry form differing between Olivero and Bartik? Meaning that in Bartik it is placed at the end while for olivero at the beginning? and as i said the help text is missing for both. But the description says Instruction to present to the user below this field on the editing form, so i would expected it to be shown in the front end?

2. The label for the introduced field Form heading is a bit unspecific and general imho. If I wouldn't have had the context from the IS i would have had to make assumptions based on the default text Add new comment. But it would be probably helpful to have a clear title and perhaps explanatory description as well?
I am not a native speaker therefor hesitant to make any definite word smithy suggestions. But something in the direction of New comment entry form heading. That would be clearer but also too lengthy unfortunately.

3. And the last point is about the placement of the field. When i've applied the patch i've searched in the comment field settings (/admin/structure/types/manage/article/fields/node.article.comment) the screenshots in the IS were about. also it is the place where the title of the comment section is set . therefor i thought i would expect the field to be found there. that the user is able to set the title for the add new comment form in the same context on the same page.
took me quite a while, and i already thought even though the patch successfully applied that something is wrong with it and it failed to provide the functionality it wants to provide, until i've realised the field is located on the edit page of a comment type /admin/structure/comment/manage/comment?destination=/admin/structure/comment. I am not sure if it would be possible and also make sense from a developer point of view to move the field to the comment field page? or what others think about that? at least for me personally it was quite confusing and an unexpected location and placement of the field.

mherchel’s picture

so is it possible that for Olivero the comment entry form title has to be added to the twig file as well? and is the positioning of the comment entry form differing between Olivero and Bartik?

Yeah, it looks like we change that around in our field--comment.html.twig. I'd be fine going back to the default, but we should talk to the UX group about it and then maybe put together a design for the small "Add new comment" jump link that appears by default.

Hopefully this answers all the Olivero related questions here. Let me know if it doesn't.

Thanks for working on this!

rkoller’s picture

StatusFileSize
new138.88 KB

I've presented the issue on yesterdays usability meeting (2022-05-06). The list of attendees was @AaronMcHale, @benjifisher, @bnjmnm, @ckrina, @shaal, @worldlinemine and me. The results are as follows:

1. The label of the form field alone is a bit vague. The group agreed to add the following description to the field to provide more clarity (the wording is based on the style of the other descriptions) : This text will be displayed as the heading of the comment form, if the theme supports it.. The second part of the sentence (after the comma) was chosen and added because it isn't sure if a frontend theme is supporting the display of the form heading field at all. And it might be confusing for the users if they add content to the form heading field and the entered text couldn't be found in the front end theme afterwards (like it is currently the case with Olivero).

2. The point I've made in #102.2 that the label form heading might be adjusted was discussed as well but it was decided against it. The combination of the label, the placeholder text Add new comment and the newly introduced description This text will be displayed as the heading of the comment form, if the theme supports it. provides enough context and clarity. So the label could remain as is.

3. The group then agreed if it would be technically possible to move the form heading field from the comment types page over to the comment field page for a content type. So the form heading is configurable along with the display label for the comment field. We haven't talked or agreed on the exact position on the comment field page. I just did a quick mockup by adding the form heading component in devtools to the page:
form heading component added to the comment field page
Addendum: While writing the comment @benjifisher commented the screenshot i've posted alongside in the #ux channel and agreed that the position of the form heading field is good: "near the other text fields and above the other form elements"

4. When checking the latest patch in #96 the variable form_heading is added to the field--comment.html.twig in Bartik and wrapped in a h2. At the moment field--comment.html.twig in Olivero doesn't contain the same addition of the form_heading variable wrapped in a h2. That way the effect of the patch isn't visible to users who have selected Olivero as their default theme, which could create or lead into confusion. So it would be good to add it for Olivero as well.

@mherchel i've noticed that i have forgot to bring up the order of the comment components in yesterdays call. sorry about that. :( but i think that detail isn't directly related to this issue. therefor we could revisit in one of the next ux meeting calls and create a follow up issue in case the rest of the group considers it an issue as well? You think that would be ok?

Thank you for all the work on the issue, and definitely a good and useful addition to Core. :)

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

aaronmchale’s picture

Issue tags: -Needs usability review

Usability review was provided in comment #104, removing tag.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

cedewey’s picture

Title: You can add a review, opinion, greeting, etc. comment type but not change the "Add new comment" text » Allow a sitebuilder to change the Comment form heading
Issue summary: View changes

I've updated the task description based on the UX committee's recommendations.

As the Comment Module's maintainers, @larowlan or @andypost can you review the proposed resolution and state whether you approve of the proposed resolution? And if not, list out your concerns and ideally an alternative proposal?

cedewey’s picture

Category: Task » Feature request

jacobupal made their first commit to this issue’s fork.

andypost’s picture

Related issues: +#1920044: Move comment field settings that relate to rendering to formatter options
jacobupal’s picture

Updated the issue branch to make it merge-able again since conflicts arising from https://www.drupal.org/project/drupal/issues/3396165

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.