We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2ec77db commit 4704924Copy full SHA for 4704924
1 file changed
src/js/controllers/tabs_controller.js
@@ -5,14 +5,15 @@ export default class extends Controller {
5
6
connect() {
7
this.activeTabClasses = (this.data.get("activeTab") || "active").split(" ")
8
- this.inactiveTabClasses = (
9
- this.data.get("inactiveTab") || "inactive"
10
- ).split(" ")
+ this.inactiveTabClasses = (this.data.get("inactiveTab") || "inactive").split(" ")
11
if (this.anchor) {
12
- this.index = this.tabTargets.findIndex((tab) => tab.id === this.anchor)
13
- this.showTab()
+ const index = this.tabTargets.findIndex((tab) => tab.id === this.anchor)
+ if (index >= 0) {
+ this.index = index
+ this.showTab()
14
+ }
15
}
- }
16
+}
17
18
change(event) {
19
event.preventDefault()
0 commit comments