Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Long strings within comments break the layout of the page.
How to replicate:
Make a comment with very long line (like ______________________) or a long url
It will break the layout of the comment boxes.
Example screenshots:
Current code at HEAD for the .comment__content wrapper
.comment__content {
position: relative;
display: table-cell;
padding: 10px 25px 10px 25px;
vertical-align: top;
width: 100%;
border: 1px solid #d3d7d9;
font-size: 0.929em;
line-height: 1.6;
}
Proposed resolution
Add a fix so that long strings wrap within the .comment__content
container.
Remaining tasks
Write a patch
Visual review - Post screenshots
Code review
User interface changes
Fixes a broken page layout caused by long strings in comments.
API changes
none
Data model changes
none
Beta phase evaluation
Issue category | Bug because strings in comments can break the page layout of Bartik - especially on mobile |
---|---|
Issue priority | Normal because it is a visual bug with Bartik only. |
Unfrozen changes | Unfrozen because it only changes CSS. |
Prioritized changes | The main goal of this issue is usability. Currently if someone adds a long URL to a comment the site layout breaks on smaller screens. |
Disruption | Non-disruptive |
Comment | File | Size | Author |
---|---|---|---|
#48 | long-comments-1085472-35.patch | 396 bytes | emma.maria |
#45 | core-strings-break-bartiks-page-layout-1085472-8-44.patch | 406 bytes | martins.kajins |
#43 | Screen Shot 2015-09-07 at 21.49.51.png | 122.93 KB | emma.maria |
#43 | Screen Shot 2015-09-07 at 21.49.31.png | 65.1 KB | emma.maria |
#43 | Screen Shot 2015-09-07 at 21.45.48.png | 69.44 KB | emma.maria |
Comments
Comment #1
corbacho CreditAttribution: corbacho commentedI removed that fix because wasn't working in Google Chrome.
Comment #2
tatianataylor CreditAttribution: tatianataylor commentedCorbacho,
Would you be able to say which .inc file or module was this code at? I am trying to find where is the issue in the code first so maybe I can create a patch.
Thanks,
T.
Comment #3
kpun CreditAttribution: kpun as a volunteer and commentedComment #4
kpun CreditAttribution: kpun as a volunteer and commented@Corbacho i think the changes you have mentioned should be made in the .comment section .
Comment #5
corbacho CreditAttribution: corbacho commentedHi kpun, I can't replicate anymore the bug in Drupal 7. It seems it has been fixed with the solution you are proposing.
btw, The patch contains changes to the menu.module that shouldn't be there.
I was going to close the issue... but I can replicate the problem in Drupal 8 (changing issue metadata)
Could you add these 3 lines to Drupal 8 ? I tested on Chrome devtools, and it worked.
Comment #6
corbacho CreditAttribution: corbacho commentedComment #7
kpun CreditAttribution: kpun as a volunteer and commenteddone
Comment #11
kpun CreditAttribution: kpun as a volunteer and commentedComment #12
kpun CreditAttribution: kpun as a volunteer and commentedComment #14
kpun CreditAttribution: kpun as a volunteer and commentedcorbacho could you please tell why the patch does not work ? I am not able to figure it out.
Comment #15
corbacho CreditAttribution: corbacho commentedThanks for the patch!
it seems a random error, not related to the patch. Let's try again
Comment #20
corbacho CreditAttribution: corbacho commentedme not understand
Comment #23
corbacho CreditAttribution: corbacho commentedlet's try re-uploading patch #7 from kpun (credit to him)
Comment #27
emma.mariaAh! The reason why it is not working is that style.css does not exist in Bartik in D8. The CSS now has a SMACSS style architecture so the patch needs to affect the new files.
Comment #28
emma.mariaI have also found this issue within a Forum table also...
Comment #29
corbacho CreditAttribution: corbacho commented:O mistery solved!
I'll ping kpun if he wants to finish the job
Comment #30
rudraram CreditAttribution: rudraram at Axelerant commented@emma.maria @corbacho This issue looks file with the comment section but exists with the forums table. Attaching comment section screenshot.
Comment #31
emma.mariaThe issue posted in #28 is different to the original issue. The original issue is with no word spacing.
I will have a test and maybe post a seperate issue.
Also unassigning for now as @kpun has not been active on this issue for a month and we should open it up again.
Comment #32
emma.mariaLet's ignore the Forum table issue within this issue, it's not the same.
The issue here is that if you add a long string to a comment, it will continue to push the comment out of the page container because of this style. This is particularly needed for small mobile widths as the space for comments is so small...
I tried using the solution posted in the IS and the previous patch to the current codebase but it caused further regressions and did not help :-(
The comments code has been refactored since this bug was discovered. So we need a new CSS solution!
The current code on the comment content is...
PS.
word-wrap: break-word
which is set on the body does not work on mobile devices for some reason.Comment #33
emma.mariaI've updated the Issue summary.
Comment #34
emma.mariaComment #35
rudraram CreditAttribution: rudraram at Axelerant commentedAs
word-wrap: break-word
is not working on mobile devices I have usedword-break: break-all
just for the.comment__wrapper
. I don't know if this is ok but it works. Patch uploadedComment #36
rudraram CreditAttribution: rudraram at Axelerant commentedComment #38
rudraram CreditAttribution: rudraram at Axelerant commented@emma.maria The below image from your upload shows 8.0.x and the version for this issue is mentioned as 8.1.x-dev.
Comment #39
emma.mariaOk thanks, I've changed the version to 8.0.x I would like this fixed ASAP.
Comment #41
rudraram CreditAttribution: rudraram at Axelerant commented@emma.maria Thoughts on #35 ?
Comment #42
briandev CreditAttribution: briandev commentedMaybe we can set the "break-word" to only apply to anchor links within comments:
Comment #43
emma.mariaThanks @rudraram for the patch!
I can confirm that word-wrap has no effect but word-break fixes the visual issue.
I checked
word-break
on caniuse.com and it has pretty good support.Namely the
word-break: break-word
combination has this description...Therefore I am happy with this solution!
Screenshots:
Chrome
Firefox
Safari
IE9
Comment #45
martins.kajins CreditAttribution: martins.kajins commentedComment #47
emma.maria@martins.kajins thanks for your patch. However your solution you provided is different from the patch that was tested, solved the issue and was set to RTBC in #35.
The patch in #35 was set to red by the testbot and still cleanly applies. It is retesting now and I will set this back to RTBC based on #35 again.
Comment #48
emma.mariaTo avoid confusion with what patch to commit here is a straight re-upload of @rudraram's patch from #35.
Setting this issue back to RTBC.
Comment #49
webchickCommitted and pushed to 8.0.x. Thanks!
Comment #52
paintingguy CreditAttribution: paintingguy commentedSorry if I am duplicating the Q&A but I'm having this issue right now with D8 current release. Is there a fix in this post ? Thanks.
Comment #53
paintingguy CreditAttribution: paintingguy commentedAh, I tried this and it worked:
diff --git a/core/themes/bartik/css/components/comments.css b/core/themes/bartik/css/components/comments.css
index 30e1be8..03bbfd1 100644
--- a/core/themes/bartik/css/components/comments.css
+++ b/core/themes/bartik/css/components/comments.css
@@ -61,6 +61,7 @@
Comment #54
jonathanshawI wonder if this issue has introduced a regression: #2679126: Words break unnecessarilly at end of line in forum topic replies.
Perhaps #42 above offers a direction.
Comment #55
jonathanshawAn alternative solution to this issue is now proposed in #2679126