Skip to content

Commit

Permalink
🐛 Use id for navigating Options page tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
richardfrost committed Sep 9, 2024
1 parent d4922da commit ba911bc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/script/optionPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1777,12 +1777,14 @@ export default class OptionPage {
currentTab.classList.remove(this.Class.activeClass);
newTab.classList.add(this.Class.activeClass);

const currentPage = document.getElementById(currentTab.textContent.toLowerCase() + 'Page') as HTMLElement;
const newPage = document.getElementById(newTab.textContent.toLowerCase() + 'Page') as HTMLElement;
const oldTabName = currentTab.id.replace('Tab', '').toLowerCase();
const newTabName = newTab.id.replace('Tab', '').toLowerCase();
const currentPage = document.getElementById(`${oldTabName}Page`) as HTMLElement;
const newPage = document.getElementById(`${newTabName}Page`) as HTMLElement;
this.Class.hide(currentPage);
this.Class.show(newPage);

switch (newTab.textContent.toLowerCase()) {
switch (newTabName) {
case 'test':
document.getElementById('testText').focus();
break;
Expand Down

0 comments on commit ba911bc

Please sign in to comment.