I am looking at a site where there is an extra <br> tag being inserted between all elements in rich-text fields in custom fieldsets, including between list items! And two being inserted between paragraphs. The html is clean in the editor, but this is how it's being rendered on the front-end. This is only happening when the fieldset is set to display as a tab. As soon as you move it 'inline', the problem goes away. Site is using default CKEditor.

Any ideas about why this could be happening and how to fix it? Thank you.

  • I'm not seeing this happen on the public demo dmaster.demo.civicrm.org. Any more details about what might be specific to your install? Which version of civi? Which CMS? Any relevant extensions? – Demerit Aug 1 '19 at 21:40
  • Thanks for checking this out. I have just tried this on the demo site and I can confirm it is happening. I added a custom field set to contacts, which I set to appear in a tab, then a 'note' type field and set it to be rich text. On a contact record, I added a couple of paragraphs (by hitting return between them) - looks good on the backend, but 2 x <br> tags between each <p> appearing on the front-end. – Katy J Aug 2 '19 at 4:51

Oh I get it now. You mean <br> tags in the html source when you are in view mode causing extra line spacing to appear on the screen, not the literal <br> appearing as a visible string <br> on the screen.

So I personally agree that's not a faithful representation of the stored html which normally ignores whitespace when displayed, but it looks like it's been that way for a long time. Where this is coming from is https://issues.civicrm.org/jira/browse/CRM-11598 which doesn't specifically say it but I'm assuming it's referring to when you choose TextArea as the type for the Note field, where you would want this. The code looks like it's here: https://github.com/civicrm/civicrm-core/blob/master/templates/CRM/Custom/Page/CustomDataView.tpl#L90

So ideally it would also check to see whether it's TextArea or RichText. You can file a bug report at https://lab.civicrm.org/dev/core/issues

  • I know this is a year old, but I think we just ran into this issue. Was a bug ever filed and worked on? Seems like it's still happening in version 5.27 – Paul B Aug 10 '20 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.