בעיית תצוגה באלמנט "הסתר פרטים"

סיכום מבוסס בינה מלאכותית

The discussion revolves around a display issue in the “hide details” element, where inline elements like <sub> and links are incorrectly rendered as block elements due to CSS rules targeting details[open] children. Canapin identifies that the issue arises when content is not properly wrapped in <p> tags, as the absence of a line break causes markdown to treat the content as a single block. JammyDodger suggests that the problem may be related to the interaction between markdown and HTML, and notes that enabling safe mode (which disables plugins) resolves the issue, possibly because the “hide details” feature is treated as a plugin. Canapin acknowledges the workaround but expresses interest in understanding the rationale behind the CSS rules that force block display on all direct children and siblings within the details element, which JammyDodger highlights as a potential area for community insight.

In this block,

[details="Summary"]
This text will be hidden
[/details]

There’s two CSS rules that makes display: block on every child or sibling elements:

details[open]>*, details[open] .lightbox-wrapper {
    display: block;
}
details[open]>summary:first-of-type ~ *,
details.open>summary:first-of-type ~ * {
    display: block;
}

This is a problem because each element that is supposed to be inline will be displayed as a block instead, taking all the width. Like a span or a link. What’s the purpose of these rules? :thinking:

Example:

[details="Hidden"]
Enhanced image and comparison with the same halo on Earth:
![66bb711c57dd10e4e4f9713ebeec0ccec9a8d0dc1|220x499](upload://eEOifbxarMIErU6OnozO45BJq0I.jpeg)
![541efc040f313220531d74677a9105e44890c29c1|442x500](upload://c0ausOGkNA0BJMAsmAnOqmpWBv6.jpeg)
Though Mars's atmosphere is composed of 95% of carbon dioxide (CO<sub>2</sub>), the halo was produced by water (H<sub>2</sub>O) ice crystal, hence the similarity with the common Earth 22° [halo](https://en.wikipedia.org/wiki/22%C2%B0_halo?oldformat=true). It's exactly the same, in fact.
[/details]

↓

Hidden

Enhanced image and comparison with the same halo on Earth:



Though Mars’s atmosphere is composed of 95% of carbon dioxide (CO2), the halo was produced by water (H2O) ice crystal, hence the similarity with the common Earth 22° halo. It’s exactly the same, in fact.


Here there are 3 inline elements: <sub> and a link:



The issue disappears if we enable the safe mode and disable all plugins, even if we have no custom plugins installed:


image


A video example from try.discourse.org:

לייק 1

Hi @Canapin :slightly_smiling_face:

I think (if I’m following this right) this is because of the mix between markdown and HTML. If you leave a linespace between the image and the picture then it should display as you intend:

Hidden

Enhanced image and comparison with the same halo on Earth:


Though Mars’s atmosphere is composed of 95% of carbon dioxide (CO2), the halo was produced by water (H2O) ice crystal, hence the similarity with the common Earth 22° halo. It’s exactly the same, in fact.

I believe the details are counted as a plugin, so if you disable official plugins in safe mode then that will turn them off.

לייק 1

Aaah, I see. Because I didn’t put a line break, the following text content wasn’t wrapped by a <p>.

Easy to fix when writing then. That will do for me if this isn’t fixed in the future, though I suppose that could confuse other people sometimes (but I didn’t see any other report so…).

Also, note that the preview works well but not the final post.


I also would be interested in the reasoning behind the CSS rules that make every direct child/sibling a block element inside the Hide Details container.

לייק 1

I’m afraid this I do not know. :slight_smile: But I’ll pull it out as a quote to give it a little bump in case it got overlooked previously, and hopefully someone else in the community knows more. :crossed_fingers:

לייק 1