Skip to content

Commit 9a50c0a

Browse files
fix: prevent tab anchor from overriding non-tab URL hashes
1 parent 2ec77db commit 9a50c0a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/js/controllers/tabs_controller.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ export default class extends Controller {
99
this.data.get("inactiveTab") || "inactive"
1010
).split(" ")
1111
if (this.anchor) {
12-
this.index = this.tabTargets.findIndex((tab) => tab.id === this.anchor)
13-
this.showTab()
12+
const index = this.tabTargets.findIndex((tab) => tab.id === this.anchor)
13+
if (index >= 0) {
14+
this.index = index
15+
this.showTab()
16+
}
1417
}
1518
}
1619

0 commit comments

Comments
 (0)