XF 2.0 XenForo posts have no paragraph tags <p></p>, only line breaks <br />

Excell

Member
I noticed the WYSIWYG editor used in the XenForo software does not generate paragraph tags (<p></p>). I checked the posts in this forum and found only line breaks <br /> between paragraphs. Using line breaks to space paragraphs can be semantically inappropriate.

Did anyone notice this problem?
 
Last edited:

Chris D

XenForo developer
Staff member
It is an option in the editor as to how new lines are created but it is simply our preference to use HTML line breaks rather than other options.

So it’s working as we designed it to. You seem to indicate this is problematic. How so?
 

Excell

Member
I've made it very clear that paragraphs should normally be spaced by <p></p> tags. However when copying long posts from a text editor like everyone is doing, the paragraph breaks are made by the <br /> tags.

Just check the long posts with paragraphs in this forum, there're no <p></p> tags in the source code. If you think <p></p>tags can be replaced by two <br /> tags, I have nothing to say.
 
Last edited:

Chris D

XenForo developer
Staff member
You've made it very clear what you want. You haven't made it clear why or what issue the current behaviour causes or what issue the desired behaviour solves.
 

adamgreenough

Well-known member
Hi @Chris D, is it possible for a admin to override this questionable preference? There are many reasons this would be a massive improvement.

The official HTML spec says this is wrong, as does MDN​

It should not really be up for debate that line break tags should not be used to space paragraphs. The MDN agrees. The official W3 HTML spec has the following to say:

"br elements must be used only for line breaks that are actually part of the content, as in poems or addresses."

Bad accessibility, no paragraph pacing or navigation on screen readers​

As far as accessibility is concerned, line breaks are read over without a pause (like a space between words) in the screen readers that I have tried where as paragraphs have appropriate pacing. It also breaks the ability for reader users to jump between paragraphs.

iOS errors with double line breaks​

Opting to use paragraphs instead of line breaks on hard returns plus a bit of CSS to reflect this change in the editor and post view would essentially solve my problem with shift deactivating on iOS after using two new lines to manually indicate a new paragraph.


It is simply bad typesetting​

From a styling perspective, I would prefer to have less space than a double BR provides to separate paragraphs. It is not proper typesetting to have a whole line height between paragraphs. It would also make it much easier to provide consistent spacing between embeds, new lines, quotes, etc. which is an annoying problem currently.

I am not sure in what sense that a double line break can be considered a valid way to represent paragraphs as you suggest.

I would expect that Google is smart enough to compensate for poor HTML semantics and gloss over line breaks as paragraphs but this is besides the point.

I would strongly urge you to reconsider using the line breaks in place of a proper paragraph tag or would be very grateful for a workaround to force this on our individual forums if desired. Doing this in 2.2 seems like the perfect time. I am very excited for all of the other awesome changes and love XenForo overall. This would make it perfect for me.

If not, I would love some insight into why this is the preference for XenForo?



MDN:
Screenshot 2020-08-07 at 06.02.24.png
Screenshot 2020-08-07 at 07.48.16.png

Official W3 Spec:
Screenshot 2020-08-07 at 06.06.01.png

 
Last edited:

adamgreenough

Well-known member
Tried overriding this in JS but looks like Froala is actually set to use paragraphs in their settings but these are converted to line breaks in the backend parser. You can see using inspect element that the XenForo editor uses paragraphs with margins removed in CSS already when editing in the editor whereas in the Froala example of using BR it is more accurately using line breaks even in the editor.

 

djbaxter

Well-known member
I don't understand why this is an issue. I don't think I or any members on forums I manage have ever encountered a problem with this.

Molehill -> Mountain
 

adamgreenough

Well-known member
I don't understand why this is an issue. I don't think I or any members on forums I manage have ever encountered a problem with this.

Molehill -> Mountain
I explained pretty clearly why it was an issue. Using paragraphs is a far superior way of formatting in every aspect to simply shoving line breaks in. Because many are ignorant to the effects of this isn't a good reason not to tackle it. Chris seems to be justifying the decision to use line breaks, it is clearly an option for them, so very curious to hear why the by all other accounts wrong way is being used here.
 

djbaxter

Well-known member
Actually, you haven't "explained pretty clearly why it was an issue ".

I was confused by why you thought it was an issue when you first posted. Your subsequent posts haven't made it any more clear. Nor have you given any examples of instances where this created a problem for forum posters.
 

adamgreenough

Well-known member
Actually, you haven't "explained pretty clearly why it was an issue ".

I was confused by why you thought it was an issue when you first posted. Your subsequent posts haven't made it any more clear. Nor have you given any examples of instances where this created a problem for forum posters.
To be clear, I am not the OP. Did you miss my post full of objective reasons? I thought I posted a pretty good breakdown above though. I agree the original poster did not do a great job of explaining the why.
  • It causes ugly typesetting with too large paragraph spacing and often results in uneven/unpredictable spacing between paragraphs and embeds and lists
  • People who use screen readers get a subpar listening experience without the benefit of paragraph spacing and lose the ability to scrub through paragraphs of long text, this is compounded by not using proper headings tags in posts so there are very limited options to skip through text
  • iOS has a very annoying bug of disabling auto sentence case shift after two line breaks which would be fixed by only needing the one with paragraphs
These are all real problems experienced by real users.

In addition...
  • Search engines loves semantic HTML, this ain't it
  • It is the wrong use of HTML according to the spec
It's been asked for for a while but I'll reserve judgement on why this wasn't implemented in 1.X.

Why would you oppose this change? Chris mentions it is an option for them so presumably not a large development.

 
Last edited:

adamgreenough

Well-known member
Thanks @Lawrence! Totally agree. Very keen to hear from a developer to help me decide how to proceed with this. As an add-on developer, do you perhaps know if this is something that could be patched with a custom add-on? Ideally at its source rather than filtering the output which might not be very reliable.
 

Excell

Member
I don't understand why this is an issue. I don't think I or any members on forums I manage have ever encountered a problem with this.

Molehill -> Mountain
I don't understand why this is NOT an issue. @adamgreenough explained so much about the benefits of using paragraph tags instead of line breaks. Indeed, it's obviously a rule to use paragraph tags to separate paragraphs. Just because no any members mentioned it previously could we think it isn't an issue?
 
Top