Creating a collapse instance shouldn't also toggle the element #38418
Unanswered
philipstratford
asked this question in
Ideas
Replies: 1 comment
-
You are absolute right on this |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I find the collapse feature in BS5 to be much less pleasant to use than in previous versions. I've just spent quite a lot of time trying to work out why my collapsible elements were immediately toggling when a collapse instance was created. I was doing this:
expecting to subsequently be able to call
when I needed to show the content (which is after another element is clicked, not immediately). I couldn't work out why the element was being shown immediately until I eventually realised that that is by design, which seems very unintuitive to me. I finally understood that the example in the docs:
isn't really a suggestion (i.e. "You can pass the
toggle
option if you want to"), it's a requirement if you don't want the element to immediately be shown.To me it would be much more intuitive for the basic initialisation with no options parameter to do nothing but return a collapse instance, and require the state to be set explicitly. I.e:
or perhaps
At the very least, the documentation should be absolutely explicit that creating a collapse instance will also cause it to be toggled to visible unless an options parameter is passed to prevent it.
Beta Was this translation helpful? Give feedback.
All reactions