News item - double opening and closing <p> tag bug


(Pawel Masloch) #1

Hi,

I have come across a bug when adding some content to news item page.
It looks like Matrix pumps in ‘p’ tags by default in the body WYSIWYG Content Container.
Unfortunately, it fails basic html validation, and also we get marked on accessibility…

Any idea if the bug’s on ‘fix me’ bucket list and/or timescale?..

Thanks.

SQM v5.4.2.0


(Nick Papadatos) #2

Interesting issue you have there. Try (not ideal though as you shouldn’t see empty or nested p tags ) adding a paint layout to your news items. In the default format add:

%asset_attribute_summary%

%asset_attribute_body%

etc

Cheers
Nick


(Pawel Masloch) #3

Hi @NickyP,

Thanks for a message. You are right, I am not sure about paint layouts there but certainly can have a crack on it…
Having said that, it looks to me like a bug. And it would be nice to have it fixed… I have also noticed Matrix pumps in a lot of unnecessary tags in different areas especially when editors add content in WYSIWYG… It seems like nothing but then when I have to run my Accessibility checks I end up with 1000+ pages and random tags all over the place e.g. type = ‘disc’ on ul (etc.)

Cheers mate.


(John gill) #4

Definitely looks like a bug to me, snippet of code from the printBody function in news_item.inc

if ($this->attr('show_body')) {
?>
<div id="sq_news_body">
    <p><?php echo $this->attr('body'); ?></p>
</div>
<?php
}

Given that body will always be the result of a WYSIWYG area, it doesn’t make sense to wrap it in a <p> tag.

NickyP is right that a type customisation for the paint layout will let you work around it. A paint layout to replicate the default behaviour but without the p tag issues around body and summary would be roughly:

%begin_asset_attribute_show_headline%
<h1>%asset_attribute_name%</h1>
%end_asset%

%begin_asset_attribute_show_summary%
<div id="sq_news_summary">
  %asset_attribute_summary%
</div>
%end_asset%

%begin_asset_attribute_show_body%
<div id="sq_news_body">
  %asset_attribute_body%
</div>
%end_asset%

<div id="sq_news_contact">
%begin_asset_attribute_show_contact_name%
<p>Contact: %asset_attribute_contact_name%</p>
%end_asset%
%begin_asset_attribute_show_contact_phone%
<p>Phone: %asset_attribute_contact_phone%</p>
%end_asset%
%begin_asset_attribute_show_contact_email%
<p>Email: %asset_attribute_contact_email%</p>
%end_asset%
</div>

Given that fixing it would involve changing the behaviour of existing uses, and there’s a workaround, I doubt it’d get fixed.


(Pawel Masloch) #5

Hi @JohnGill,

OK - I get the point. If that is a case, we will move away from news items, I guess . Also, it looks to me that creating a new and dedicated micro site hosting council’s news and public updates (in standard pages) is way forward for us.

Thank you for your input. Cheers.


(Bart Banda) #6

That’s def a bug, I’ll report it to our backlog and we’ll get it fixed in the next release or 2. Thanks for reporting!


(Nick) #7

Hi guys I am new here but have recently experienced same issue with double para tags.
So to fix that I just created a new paint layout and assigned it to my news item.
code example i used below, hope it helps someone else.

 <div class="content-container custom-news-item">
  <h1 class="custom-news__title"> %asset_name% </h1>
  <div class="custom-news__summary"> %asset_attribute_summary% </div>
  <div class="custom-news__body"> %asset_attribute_body% </div></div>

(Bart Banda) #8

Thanks for sharing @nicko2u!