Skip to content

Commit

Permalink
fix(@dpc-sdp/ripple-nuxt-tide): fix pages breaking when numbers are u…
Browse files Browse the repository at this point in the history
…sed at the start of an in page nav item (#1310)

Co-authored-by: David Featherston <david.featherstone@dpc.vic.gov.au>
  • Loading branch information
lambry and David Featherston committed Aug 17, 2023
1 parent bc75f33 commit bdb47fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/ripple-nuxt-tide/lib/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ export default {
this.announcerTitle = `Page loading`
},
anchorScrollFix (hashbang) {
const elmnt = document.querySelector(hashbang)
// Hashes can start with a number "#2-item" making them invalid, so we need to use an attribute selector
const idSelector = `[id="${hashbang.replace('#', '')}"]`
const elmnt = document.querySelector(idSelector)
if (elmnt) {
elmnt.scrollIntoView()
}
Expand Down

0 comments on commit bdb47fc

Please sign in to comment.