NO BUG: Variable stripping formatting from elements?

Browser: Chrome 110
OS: macOS / Windows / Linux / etc.
URL: Link to a page that illustrates this issue
Video: Short screen recording that illustrates this issue (free tool: jam.dev)

I am using {archive_description} in basic text and heading areas, which have classes on, but front end this then strips all the formatting off the section and it just returns as a classless, basic p tag.

Please see:
https://jam.dev/c/01093261-259e-49dc-9602-e93d58704d18

No sound, but I am showing the two divs within the builder, both Heading and Basic Text sections, which have classes and look fine and are styled, but front end, they are just plan p without classes added?

Hi @robp,

thank you for your report! I watched your video and I think I know what is happening here, so I will mark this post as a NO BUG.

I believe that your {archive_description} dynamic tag is returning data in paragraphs, not only text. And because you have custom tag for basic text, and you set it to p, it will cause nested p elements, which is not ok.
And when this happens, the pfrom your archive description, will automatically close the p from the basic text.

So, if you set your basic text to the div, it should work.

Best regards,
M

1 Like

Thank you, that’s spot on actually. I had no idea that the shortcodes could do that in Bricks to be honest, but I guess it’s autop related?

Hey @robp,

first, sorry for the late response.
Now, what do you mean by " had no idea that the shortcodes could do that in Bricks"? You mean causing this problem you are having?
If yes, then pleas know that it’s not Bricks who is creating this, but browsers, when parsing/rendering elements.
Or it’s something else you had in mind?

Best regards,
M

Hey @Matej

I meant that I thought the shortcodes only returned the values of the field in a raw format, unformatted.

I didn’t realise they could return values with autop / paragraph formatting on them.

Cheers

Yeah, dynamic tag will return whatever the HTML structure is there, but then the browser parses/changes it that way.

Best regards
M

I see what you mean - so the browser has the ability to alter the semantic markup to adjust to what it feels it should be like?

Yes, basically… because of the HTML specification. :slight_smile:

I think this answer is describing it very good, with a nice link to the specs: html - Nesting <p> won't work while nesting <div> will? - Stack Overflow

Best regards,
M

1 Like

Makes sense, thank you!

1 Like