[details] breaks when embedded in a paragraph

In Discourse 1.8.0.beta13, the [details=Spoiler]This should be hidden[details] logic doesn’t work if it’s embedded in a paragraph. It does work if it’s separated by a newline. The problem appears to be in the generated html, as it’s reproducible in Chrome, Firefox, and Safari.


details tag with proceeding newline

This text is hidden until you click the text.


Here’s an embedded [details=details tag embedded]This text shows up all the time in the page, but the preview makes it looks like it works.[/details] paragraph.

Not really a bug, we expect newlines there.

Expecting newlines might be the bug.

Why does the preview have the expected behavior, then? One would expect that and the rendered version to act the same.

Using [details] for spoilers and not knowing this buggy behavior means you think you left a properly hidden spoiler when in fact you didn’t. This has been super aggravating, confusing, and unexpected for myself and friends on another discourse instance.

Details is by definition a block level element. If you want inline, use the other style which is called … wait for it… SPOILER.

It works kinda like this you see.

It works [spoiler]kinda like this[/spoiler] you see.

I think this is a real bug here. The [details] tag renders differently in preview than in the cooked post. I’ve experienced it myself. I’ve also had to try and explain to my users why something looks OK in preview but fails once posted.

3 Likes

Yeah, the preview not being consistent with the final cooked post is annoying. Will fix.

4 Likes

Preview is now consistent with the cooked post (none of them support being “embedded” in a paragraph).

2 Likes