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.
The vertical tabs summary on node type forms has spaces before commas.
See picture:
Comments
Comment #1
joachim CreditAttribution: joachim commentedHmm, unrelated, but should all those tab headings say Show and Hide?
Comment #2
Dave ReidPersonally I think that using commas to separate these summary values is wrong as the 'Publishing options' tab begins to get un-scannable. Here's a solution that I've worked on to use line breaks after each value.
There is also a problem that the 'Publishing options' tab also includes the description of any checkboxes in the summary.
Comment #3
Dave ReidComment #4
droplet CreditAttribution: droplet commentedanother issue: font should not small than 12px.
Comment #5
joachim CreditAttribution: joachim commentedIt does make the summary more readable... but on the other hand, doesn't that make the vertical tabs rather too tall and remove part of their original design intent to be compact?
Comment #6
joachim CreditAttribution: joachim commentedHa. Tracked it down! The problem is that field labels are made like this:
'!title !required'
So if there is no required on a field, it gets a stray space at the end.
I think the correct fix is to remove that space, rather than have the vertical tabs JS jump through hoops in every form that uses them to trim the values!
Dave Reid's suggestion in #2 really belongs in a feature request; and the inclusion of checkbox description is another bug for another day. The patch here fixes the original stated problem :)
Comment #7
joachim CreditAttribution: joachim commentedTagging for backport, removing need to UX review as that's for the improvement suggestion.
Comment #8
xjmPatch looks good to me. There's not really any reason to test for whether or not we have a stray space somewhere. Can we get before/after screenshots with the patch though?
Comment #9
joachim CreditAttribution: joachim commentedFor the before screenshot, see the original post.
For the after screenshot, imagine that but without the spaces marked with big red circles ;)
Comment #10
xjmNote that this is a string change, technically, but there is no translatable text in the string, so there's no translations to break. Sorry @joachim. :) So this can be backported.
Comment #11
xjmUsing the official tag.
Comment #12
joachim CreditAttribution: joachim commentedUrgh. Patch no longer fixes the problem O_o
Comment #13
joachim CreditAttribution: joachim commentedThe problem is now happening somewhere in the JS -- I've got it as far as drupalGetSummary but there my JS skills run out :(
Comment #14
joachim CreditAttribution: joachim commentedOk the problem with the earlier patch is that the logic was flawed -- I was putting in the space at the front !required even when $required was empty.
That doesn't fully fix the problem though, and the culprit is this:
I presume the final \n is there for readability of HTML source.
Now I'm not sure anyone actually bothers reading HTML source any more -- I certainly haven't since Firebug came along. But I'm not sure that's a call we should be making in this issue. Also, removing just one trailing newline in a switch() where the other cases have them makes the code look weird.
But here's that change as a patch for discussion. Another approach to follow.
Comment #15
joachim CreditAttribution: joachim commentedHere's the other way of doing it: just have the JS trim() any text that goes into fieldset summary that has come from a title string.
Not as elegant, but no ideological changes involved :)
Comment #16
xjmClosed #1542700: Content type fieldset summaries contain extra spaces as duplicate of this issue.
Comment #17
tim.plunkettI opened #1542700: Content type fieldset summaries contain extra spaces, but was pointed here by xjm.
Here's a patch that mimics the similar core/modules/node/node.js directly
Comment #18
tim.plunkettSo mine is missing the comment module hunk, but now we can debate using
$.trim(foo)
vsfoo.trim()
.Comment #19
xjmSo my thought is, since we are trimming these values for the statuses for the vertical tabs on three different lines, plus the existing one in node.js... can we refactor this so we have a single function or method to handle assembling these lists of statuses and setting them to the appropriate tab? Maybe even separate methods to append, remove, update, whichever; the idea though is to refactor what is obviously repeated code so that other modules don't make the same mistake.
Comment #20
tim.plunkettMarked #1623574: Remove trailing space from form element labels and field labels (HTML nbsp) as a duplicate.
Comment #21
droplet CreditAttribution: droplet commented@joachim,
do you mind close this issue and reopen #1623574: Remove trailing space from form element labels and field labels (HTML nbsp) ? That's remove all space everywhere.
Comment #22
joachim CreditAttribution: joachim commentedYup, agreed -- that has the wider scope and the patch to cover it.
(Though I can't believe it's taken this long for other people to notice / be bugged by those spaces! ;)
Comment #23
joachim CreditAttribution: joachim commentedReopening this. It was marked as a duplicate of #1623574: Remove trailing space from form element labels and field labels (HTML nbsp), but that was committed back in 2014, and I am still seeing this problem on D8.
Comment #24
xjmComment #34
jhodgdonSave issue summary as Filtered HTML because I think that prevented editing by some people. Not sure how that happened!
Comment #35
quietone CreditAttribution: quietone as a volunteer commented@joachim, thanks for the report.
I tested on 9.2.x and the cannot reproduce the problem, see attached screenshot. It does still exist on D7 so changing version.