twbs/bootstrap

Use a single class name for opened/expanded/shown state of widgets?

Closed this issue · 7 comments

Refs #19254 (comment)

  • I don't know of any particular good reason why we currently use multiple different classes for this. Seems to just be an accident of history.
  • Using a single name would make things more uniform in general
  • Using a single name would make reimplementing Bootstrap's JS in $JS_FRAMEWORK_OF_THE_HOUR slightly easier

I'm not quite sure I understand the suggestion. Can you share an example of how this would be?

Currently, we toggle the .open class on .dropdown-menu to open/close a dropdown menu, we toggle the .active class on .tab-pane to show/hide a tab pane, and we toggle the .in class on .collapse to (un)collapse a collapsible widget. (And likewise for other widgets.)

The suggestion is to use one class name (e.g. .active) instead of different ones (.open, .active, .in) in all these cases. So you'd always toggle .active to (de)activate a widget, regardless of which widget it is.

Basically we'd globally find-replace .open, .active, and .in with .active (or whatever single name we end up agreeing on).

Seems, simpler indeed, but what is the caveat? Or it's like that from the old days?

AFAICT, old days.

Then, I don't see any reason not to do this. It's clearly simpler.

mdo commented

I'm down for this. I'm thinking .active could work well for everything?