Feature Request - Collapsible Spoilers

If the site added collapsible spoilers, that is, where it shows a block of text that has a label that when clicked on exposes all the text hidden away, long bits of information with different sections could be used. That would then make one answer for a question go from a lengthy answer to something like:




Then you would click the version you are looking for and it would reveal the answer (this example is from this question).


1 Answer 1


EDIT: Implementation

I've found an idea that is really easy to implement to make this work:

Add <details>, <summary> and the open attribute to the HTML whitelist.

The <details> tag is, by default, a collapsible section with a customizable title. Take a look at some HTML and its output.

    <title>How the &lt;Details&gt; tag Works</title>
        <summary>Click to open!</summary>
        I'm normally closed!
    <details open>
        <summary>Click to close!</summary>
        I'm normally open!



The <summary> tag goes inside the <details> tag. It contains the text that should go on the header of the collapsible section.

The open attribute is a boolean, in layman's terms, it's either present or absent. If present, it causes the section to be open by default instead of closed.

This should be so easy to implement! No CSS changing, Markdown changes or additions to custom HTML! It's simple, just add <details>, <summary>, and the open attribute to the HTML whitelist.

If When that happens because it will happen, I will enclose the "Original Post" below in a <details> tag so that it is collapsed. For now, head into the revision history if you want to read it...

  • yeah I meant the collapsible spoilers that other sites have, edited the question
    – Penguin
    Commented Nov 24, 2020 at 4:07
  • 1
    As of now, tables have been added! This shows that markdown can now be made into more complicated HTML, so maybe something like this could be implemented into the future. It seems less restricted to h1 and hr, so maybe this is a step towards this.
    – Penguin
    Commented Dec 8, 2020 at 2:28
  • on iPhone (or my outdated one) the spoilers show up as ~30px tall divs that when clicked show their content and expand. It seems like the functionality is half there on here. photo
    – Penguin
    Commented Feb 6, 2021 at 6:56
  • @Penguin Yes, but that's only an exception for the mobile skin. And it's not exactly that useful if you can't collapse it again. I would suggest adding this functionality on top of spoiler markup, not changing existing spoiler markup to reflect this.
    – One 2 Many
    Commented Feb 6, 2021 at 17:46
  • yeah ik, I was just saying the functionality is half there
    – Penguin
    Commented Feb 6, 2021 at 18:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .