Skip to content

Commit

Permalink
Show correspondence tab when anchor doesn't point to tab
Browse files Browse the repository at this point in the history
So page can scroll to a message anchor even when document tab is initially shown.
  • Loading branch information
stefanw committed Sep 28, 2023
1 parent 58dcc9d commit 19fd087
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions frontend/javascript/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,17 @@ const initTabs = (): void => {
const hashNav = Tab.getInstance(hashSelector)
if (hashNav != null) {
hashNav.show()
// scroll tab into view
hashElement.scrollIntoView()
} else {
// Show correspondence tab if hash does not belong to a tab
const correspondenceTabLink = document.querySelector(
'#correspondence-tab'
)
if (correspondenceTabLink) {
const tabInstance = Tab.getInstance(correspondenceTabLink)
tabInstance?.show()
}
}
hashElement.scrollIntoView()
}
}

Expand Down

0 comments on commit 19fd087

Please sign in to comment.