Updated: Comment #37

Problem/Motivation

  • The comment itself is rendered outside instead of inside the bubble.

Proposed resolution

  • Fix regression so that comment is rendered the same as Drupal 7 bartik:
    • Comment body and comment admin links rendered within the bubble.
    • Improve HTML 5 semantic markup. Comment #36 suggests that no additional changes other than fixing the regression be made in this issue, and issue set to "needs work" from RTBC.

Remaining tasks

  • Patch that does not cause any regressions (#24 with fix in #17)
  • Create a follow-up issue for HTML 5 markup changes.

User interface changes

  • HTML 5 semantic markup: header, footer, address, time elements.

Original report by Wim Leers

Discovered locally (ab4418e65f46a1032b77a6aa497f02f009352379).

Fresh D8 HEAD (e97a786c05203b6827bdd7dfd9ec309c308f44e4) install on simplytest.me, same problem:

Screen Shot 2013-04-09 at 18.14.09.png

The subject is rendered too low, the comment itself is rendered outside instead of inside the bubble (like it is in D7). I cannot imagine this is a conscious change.

CommentFileSizeAuthor
#44 drupal-bartik-comment-outside-bubble-1965650-44.patch2.43 KBmanningpete
#44 interdiff.txt326 bytesmanningpete
#42 drupal-bartik-comment-outside-bubble-1965650-42.patch2.43 KBmanningpete
#42 interdiff.txt345 bytesmanningpete
#39 1965650aftercomment2.png73.92 KBandymartha
#37 drupal-bartik-comment-outside-bubble-1965650-37.patch2.43 KBmradcliffe
#37 drupal-bartik-comment-outside-bubble-1965650-37-with-html5.txt3.54 KBmradcliffe
#34 beforecomment1965650.png55.28 KBandymartha
#34 aftercomment1965650.png48.54 KBandymartha
#34 aftercommentfirefox1965650.png45.78 KBandymartha
#34 aftercommentmarkup1965650.png50.78 KBandymartha
#31 1965650-31-D7.png16.02 KBpancho
#31 1965650-31-D8.png16.17 KBpancho
#30 1965650-30.png30.03 KBpancho
#30 interdiff.txt846 bytespancho
#30 drupal-bartik-comment-outside-bubble-1965650-30.patch3.54 KBpancho
#24 drupal-bartik-comment-outside-bubble-1965650-24.patch3.35 KBpancho
#24 interdiff.txt2.49 KBpancho
#24 1965650-24.png16.03 KBpancho
#23 drupal-bartik-comment-outside-bubble-1965650-23.patch1.98 KBpancho
#23 interdiff.txt2.56 KBpancho
#23 1965650-23.png16.47 KBpancho
#17 drupal-bartik-comment-outside-bubble-1965650-17.patch3.62 KBmradcliffe
#17 comment-bubble-fixed-with-footer-links.png24.25 KBmradcliffe
#16 drupal-bartic-comment-outside-bubble-1965650-16.patch3.2 KBDeeLay
#12 commentoutsidebefore1.png32.74 KBandymartha
#12 commentoutsideafter1.png32.56 KBandymartha
#12 commentoutsideafter2.png58.32 KBandymartha
#7 core-bartek_comment_template-1965650-0.patch1.77 KBadam clarey
#4 Screenshot_12_04_2013_20_42.png25.8 KBalexpott
#4 Screenshot_12_04_2013_20_51.png21.9 KBalexpott
Screen Shot 2013-04-09 at 18.14.09.png130.09 KBwim leers

Comments

swentel’s picture

I can confirm the behavior.

What's even more weird, and I think even more critical than that rendering imo, I can't even submit a comment in when the comment box has an editor ..
Getting following errors in console too:

An invalid form control with name='comment_body[und][0][value]' is not focusable.

wim leers’s picture

To your secondary problem: that's a known problem, due to HTML5 validation + WYSIWYG editor, see #1954968: Required CKEditor fields always fail HTML5 validation.

webchick’s picture

Priority: Critical » Major
Issue tags: +Novice

Jess says this might be easy to fix. :D Tagging novice.

Also, this probably doesn't need to be *critical*. It's very dumb, but we could certainly ship D8 with dumb styling. Reducing to major.

alexpott’s picture

Just looking at the markup not sure that this is a novice issue. In D8 the <header> markup contains the attribution. I might be wrong (css and markup is not my area of expertise) but I think that in order to make this look like d7 options are:

  • some seriously funky css

OR

  • we are going to have to move the attribution outside of the header and wrapper the header, content and footer in a wrapper.

OR

  • come up with a new design

D8 comment markup

<article class="comment by-anonymous clearfix" about="/comment/1#comment-1" typeof="sioc:Post sioct:Comment" role="article">

  <header class="comment-header">

    <div class="attribution">
      <article class="profile">
  </article>

      <div class="submitted">
        <p class="commenter-name">
          <span rel="sioc:has_creator"><span class="username" lang="" typeof="sioc:UserAccount" property="foaf:name" datatype="">jibran (not verified)</span></span>        </p>
        <p class="comment-time">
          <span property="dc:date dc:created" content="2013-04-02T07:16:52+01:00" datatype="xsd:dateTime">02 April 2013</span>        </p>
        <p class="comment-permalink">
          <a href="/comment/1#comment-1" class="permalink" rel="bookmark">Permalink</a>        </p>
              </div>
    </div> <!-- /.attribution -->

    <div class="comment-text">
      <div class="comment-arrow"></div>

      
            <h3 class="" property="dc:title" datatype=""><a href="/comment/1#comment-1" class="permalink" rel="bookmark">Congrats</a></h3>
          </div> <!-- /.comment-text -->

  </header> <!-- /.comment-header -->

  <div class="content">
    <span rel="sioc:reply_of" resource="/node/8" class="rdf-meta"></span><div class="field field-name-comment-body field-type-text-long field-label-hidden" data-edit-id="comment/1/comment_body/und/full"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Congrats</p>
</div></div></div>  </div> <!-- /.content -->

  <footer class="comment-footer">
    
    <nav>
      <ul class="links inline"><li class="comment-reply odd first last"><a href="/comment/reply/7/1">reply</a></li></ul>    </nav>
  </footer> <!-- /.comment-footer -->

</article>

What this comment looks like...

Screenshot_12_04_2013_20_51.png

D7 comment markup

<div class="comment comment-new comment-by-node-author comment-by-viewer clearfix" about="/comment/1#comment-1" typeof="sioc:Post sioct:Comment">

  <div class="attribution">

    
    <div class="submitted">
      <p class="commenter-name">
        <span rel="sioc:has_creator"><a href="/user/1" title="View user profile." class="username" xml:lang="" about="/user/1" typeof="sioc:UserAccount" property="foaf:name">alex</a></span>      </p>
      <p class="comment-time">
        <span property="dc:date dc:created" content="2013-04-12T19:22:18+00:00" datatype="xsd:dateTime">Fri, 04/12/2013 - 19:22</span>      </p>
      <p class="comment-permalink">
        <a href="/comment/1#comment-1" class="permalink" rel="bookmark">Permalink</a>      </p>
    </div>
  </div>

  <div class="comment-text">
    <div class="comment-arrow"></div>

          <span class="new">new</span>
    
        <h3 property="dc:title" datatype=""><a href="/comment/1#comment-1" class="permalink" rel="bookmark">tertr</a></h3>
    
    <div class="content">
      <span rel="sioc:reply_of" resource="/node/2" class="rdf-meta"></span><div class="field field-name-comment-body field-type-text-long field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>werwer</p>
</div></div></div>          </div> <!-- /.content -->

    <ul class="links inline"><li class="comment-delete first"><a href="/comment/1/delete">delete</a></li>
<li class="comment-edit"><a href="/comment/1/edit">edit</a></li>
<li class="comment-reply last"><a href="/comment/reply/2/1">reply</a></li>
</ul>  </div> <!-- /.comment-text -->
</div>

What this comment looks like...

Screenshot_12_04_2013_20_42.png

jenlampton’s picture

Priority: Major » Critical
Issue tags: -Novice

This issue is blocking Twig conversion. Does that make it critical?
See #1898054: comment.module - Convert PHPTemplate templates to Twig

jenlampton’s picture

Issue tags: +Novice

whoopsie, didn't mean to remove the tag.

adam clarey’s picture

I've attached a path that fixes the problem.

I felt it was semanticly wrong to have the header element there at all so i removed it, placed the comment body after the title and added a small css change.

Now looks as it did in 7.

Adam

adam clarey’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, core-bartek_comment_template-1965650-0.patch, failed testing.

adam clarey’s picture

There must be some other problem with the test that failed, all the patch does is re-arrange some markup. There's absolutley no change to logic/php/database and the tests that failed were:

Base table or view not found: 1146 Table 'drupaltestbotmysql.simpletest845479semaphore' doesn't exist:

This is a lot deeper than a simple change of markup and css.

amateescu’s picture

Status: Needs work » Needs review
andymartha’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new58.32 KB
new32.56 KB
new32.74 KB

After applying the patch core-bartek_comment_template-1965650-0.patch by rabbit_media in #7 to a Drupal 8 fresh install, I confirm the comment subject and body are within the bubble in Bartik. See screenshots for the markup produced.

before1
after1
after 2

alexpott’s picture

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

As this was introduced in #1179764: Convert Bartik to HTML5 I'd like JohnAlbin to +1 this before committing. Completely changing the semantic markup to fix a visual defect needs oversight...

alexpott’s picture

Status: Needs review » Postponed

Postponing this on #1938840: bartik.theme - Convert PHPTemplate templates to Twig.

We can fix this bug once twig is in!

brightbold’s picture

Status: Postponed » Active

Twig is in!

DeeLay’s picture

Status: Active » Needs review
StatusFileSize
new3.2 KB

Adapted patch from #7 for twig

mradcliffe’s picture

Looking at another issue I ran into this, tried to apply the patch, and it no longer applies as of Today. I re-rolled patch.

I also noticed that the footer links are outside of the bubble in the previous patch, but in Drupal 7 the links are inside the bubble. I have fixed this regression as well in the patch.

Status: Needs review » Needs work
Issue tags: -Novice

The last submitted patch, drupal-bartik-comment-outside-bubble-1965650-17.patch, failed testing.

star-szr’s picture

Status: Needs work » Needs review
Issue tags: +Novice
yoroy’s picture

Status: Needs review » Reviewed & tested by the community

I tested this. Without the patch I see the bug as described and the latest patch fixes things. I can't review the code quality but seems to me this is rtbc.

alexpott’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/core/themes/bartik/templates/comment.html.twigundefined
@@ -65,65 +65,61 @@
-  <header class="comment-header">
+  <div class="attribution">
+    {{ user_picture }}

Hmmm are we sure that we want to remove the html5 header tag here?

We still input from someone on the new markup as per #13

pancho’s picture

Status: Needs review » Needs work

No we definitely don't want to remove <header> - it would degrade our semantical markup, see HTML5 specs.
Actually we should use more, not less HTML5 semantics, such as <time>, <link> and <address> elements, here, but this doesn't have to be in this patch.

Also, not critical per #3 and in spite of #5.

[edit:] escaped markup

pancho’s picture

Priority: Critical » Major
StatusFileSize
new16.47 KB
new2.56 KB
new1.98 KB

Here's a new patch that fixes the <header> rather than removing it.

Screenshot after patch:
Screenshot

pancho’s picture

Status: Needs work » Needs review
StatusFileSize
new16.03 KB
new2.49 KB
new3.35 KB

Implemented <address> and <time> instead of divs.
Also removed classes that are unnecessary now that we can address .comment time, .comment address, .comment header and .comment footer.

Screenshot:
1965650-24.png

Didn't manage it to avoid a tiny little difference that I couldn't track down. Needs some work, possibly in a followup issue.
Sending it to the testbot, but primarily #23 remains to be reviewed.

mradcliffe’s picture

Status: Needs review » Needs work

Is it a conscious decision to move the comment moderation links outside of the bubble?

I don't see that documented anywhere in the issue other than my comment about it being a regression. I searched for other issues, and I could not find any information regarding this change. I'm not against it, but I would like to confirm that is the intent.

yoroy’s picture

Not supposed to happen. This was fixed with the patch in #17, apparently that got lost again.

mradcliffe’s picture

Thank you, yoroy. I updated the issue summary to help clarify things.

wim leers’s picture

#24: is the <address> thing according to the HTML5 specs?

mradcliffe’s picture

I actually looked that up a bit ago. There is no format for address. It must only be the relevant contact information for the parent article or body element. The only question would be if a user link is a relevant contact link. I think it is.

<article>
<address>
I can do anything in here as long as it has relevant contact information for the article's contact. It can't be an arbitrary contact info. that doesn't relate to the article element (i.e. random postal addresses, e-mail addresses, user links, etc...).
</address>
</article>

<footer>
<address>I can do anything in here as long as it has contact information for the body.</address>
</footer>
</body>

I am a bit more concerned about the time element, which does have a specific syntax and a more confusing specification. If the datetime attribute is specified, then that needs to have the specific syntax and the content of the time element is the human-readable meaning for that date/time.

I think this is what the specification is trying to say... But it's confusing.

<!-- the time is set to the specific syntax in {{ created }} but created could not match the syntax in the spec? -->
<time>{{ created }}</time>

<!-- created means the specific syntax "11-21-2013" -->
<time datetime="11-21-2013">{{ created }}</time>
pancho’s picture

Status: Needs work » Needs review
StatusFileSize
new3.54 KB
new846 bytes
new30.03 KB

Yes, you're both right. The whole footer belongs into the box.
Here's another patch. Output looks really good now.

Screenshot:
1965650-30.png

Two things have changed against D7:

Re #29:
While I, IMHO properly, introduced the <address> and <time> elements, I omitted the datetime attribute for now. Can be a followup or rolled in. Didn't want to hold up the bug fix longer for that.

pancho’s picture

StatusFileSize
new16.17 KB
new16.02 KB

Tags seem to have become a tiny little bit larger. This might also affect other fields.
I wasn't able to track it down though because the inspector on Chromium gave me exactly the same Computed Style with exactly the same CSS rules matching. Might try it in Firefox later.

D7:
1965650-31-D7.png

D8 with patch #30:
1965650-31-D8.png

yoroy’s picture

Don't worry too much about font size of the tags. See #1218640: Bartik displays all taxonomy term fields in a smaller font than other fields for that.

pancho’s picture

andymartha’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new50.78 KB
new45.78 KB
new48.54 KB
new55.28 KB

After applying the patch drupal-bartik-comment-outside-bubble-1965650-30.patch by Pancho in #30 to a Drupal 8 fresh install 8/9 , I confirm the comment subject and body are within the bubble in Bartik and the markup contains the html5 elements. See screenshots for the markup produced. Hope someone can look at this and move it forward, thanks!

beforecomment1965650.png

beforecomment1965650.png

beforecomment1965650.png

beforecomment1965650.png

beforecomment1965650.png

aftercomment1965650.png

aftercommentfirefox1965650.png

aftercommentfirefox1965650.png

aftercommentfirefox1965650.png

aftercommentfirefox1965650.png

aftercommentfirefox1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentmarkup1965650.png

aftercommentfirefox1965650.png

aftercommentfirefox1965650.png

aftercommentfirefox1965650.png

aftercomment1965650.png

aftercomment1965650.png

aftercomment1965650.png

aftercomment1965650.png

beforecomment1965650.png

beforecomment1965650.png

beforecomment1965650.png

beforecomment1965650.png

beforecomment1965650.png

beforecomment1965650.png

andymartha’s picture

After applying the patch drupal-bartik-comment-outside-bubble-1965650-30.patch by Pancho in #30 to a Drupal 8 fresh install 8/9 , I confirm the comment subject and body are within the bubble in Bartik and the markup contains the html5 elements. See screenshots for the markup produced. Hope someone can look at this and move it forward, thanks!

beforecomment1965650.png

aftercomment1965650.png

aftercommentfirefox1965650.png

aftercommentmarkup1965650.png

webchick’s picture

Status: Reviewed & tested by the community » Needs work

While I am excited beyond belief to see this issue RTBC (yayyyy!!) the changes here look like they're expanding way beyond the scope of fixing just this one bug. :\ Adding elements like <time> and <footer> and whatnot seem like a good idea, but this is taking Bartik's comment.html.twig file quite far away from Comment module's comment.html.twig file. If some of these are good ideas for better semantic markup in all themes (which it seems like they are), then they should be proposed instead to the "upstream" template and then updated in Bartik only after a patch to change Comment module's markup is approved (or actually, as a part of that patch most likely).

Could we please slim this patch down to only the changes required to fix this one bug?

mradcliffe’s picture

Assigned: johnalbin » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.54 KB
new2.43 KB

This patch is a re-roll of #23 with the fix from #30 for the node links without any of the extra element changes in #24.

I have added a combined diff for follow-up issues. Note that bartik's comment.html.twig doesn't even have the HTML 5 mark element that core comment.html.twig has now.

mradcliffe’s picture

Issue summary: View changes

Added issue summary.

mradcliffe’s picture

Issue summary: View changes

Updated issue summary based on RTBC -> needs work comments

mradcliffe’s picture

If someone can give the patch in #37 a review comparing #30 just to make sure I didn't forget or regress anything, then I think this can be set back to RTBC.

andymartha’s picture

StatusFileSize
new73.92 KB

After applying the patch drupal-bartik-comment-outside-bubble-1965650-37.patch by mradcliffe in #38 to a Drupal 8 fresh install 8/12 , I confirm the comment subject and body are within the bubble in Bartik and the markup removes the html5 elements address and time, using p and div instead. See screenshots for the markup produced.
1965650aftercomment2.png

manningpete’s picture

Status: Needs review » Reviewed & tested by the community

This patch fully complies with coding standards, doesn't need tests, and actually solves the problem of the comment printing outside the bubble, without introducing any HTML5 elements unrelated to this particular issue.

wim leers’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/themes/bartik/css/style.css
@@ -859,6 +859,10 @@ ul.links {
+  display:table-row;

Missing space after colon.

Sorry :(

Once fixed, I'll RTBC again!

manningpete’s picture

Status: Needs work » Needs review
StatusFileSize
new345 bytes
new2.43 KB

I added a space after display and rerolled the patch from 37. Attached interdiff with patch from 37.

star-szr’s picture

Status: Needs review » Needs work
+++ b/core/themes/bartik/css/style.css
@@ -859,6 +859,10 @@ ul.links {
+.comment-footer{
+  display: table-row;
+}

And add a space before {?

Edit: referencing https://drupal.org/node/1887862.

manningpete’s picture

Status: Needs work » Needs review
StatusFileSize
new326 bytes
new2.43 KB

Added a space before the bracket.

mradcliffe’s picture

Status: Needs review » Reviewed & tested by the community

Yay, back to RTBC.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Great work!!

Committed and pushed to 8.x. Thanks!

SO glad to have this one fixed. :)

wim leers’s picture

Yes :) Now let's fix the fact the comment subject is below the comment body on the comment form!

amateescu’s picture

That would be #2044863: EntityFromController doesn't assign weights for extra fields that are not yet saved in a EntityFormDisplay. Beware, the title is misleading because the fix will probably be something else entirely :/

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Added related issue in comment.module