Closed lekoala closed 2 years ago
You mean the Tab constructor should check for a all tabs in its parent and set the first one as active, when no active tab is found?
@thednp exactly ! if your html doesn't have an active class, it will fail because the getActive method will return null. In my use case, i don't set an active class by default in the html because i need to check which tab is active in js (and avoid fouc on initial rendering). Obviously I can add the active class myself first, but it's a nice to have.
If you have the time, go ahead with a PR, and I will provide more guidance / tips on the way.
I think the show()
method of Tab need to be reworked, we would need a showTab
utility to be used for the new constructor functionality to activate first tab (if none active) on init.
I will implement this feature with the next update. Meanwhile closing the issue due to no activity.
A small difference I've noticed from bs5 is that if you create a tab object, it fails if there are no active class. Obviously you can add them beforehand in js, but it would be nice if the constructor could check if there is an active class or not and make the first tab active (and first tab-pane visible) if needed.