It's really finicky, though, so I usually type it in manually rather than use the button. If you write something, highlight it, and then click that button, then you'll put it in a spoiler/collapsible box. Putting a name in the field that pops up will give it a name.
Since the text field in New Post tends to automatically generate these things as they'd be seen in the post itself, it's hard to tell since it doesn't actually generate the box and instead invisibly "wraps" the section in it. The only way to see where it starts is if you give it a name, which is displayed in a different font. I have the same issue with pictures and youtube inserts when I insert it through the button or preview and thus turn my written BBcode into actual pictures and video.