Content-Length: 289069 | pFad | http://github.com/bootstrap-vue/bootstrap-vue/commit/5bb20ce28792aa29514ad4c435c63b7aec44a771

7F chore(docs): fix TOC navigation anchor links (#7251) · bootstrap-vue/bootstrap-vue@5bb20ce · GitHub
Skip to content

Commit 5bb20ce

Browse files
authored
chore(docs): fix TOC navigation anchor links (#7251)
1 parent 72cc7d6 commit 5bb20ce

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/utils/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ export const offsetTop = $el =>
209209

210210
// Scroll an in-page link target into view
211211
export const scrollTargetIntoView = (event, href) => {
212+
event.preventDefault()
212213
event.stopPropagation()
213214
// We use an attribute `querySelector()` rather than `getElementByID()`,
214215
// as some auto-generated ID's are invalid or not unique
@@ -223,6 +224,14 @@ export const scrollTargetIntoView = (event, href) => {
223224
$el.tabIndex = -1
224225
// Focus the heading
225226
$el.focus()
227+
// Update the URL to show the hash without changing the current path
228+
const currentPath = window.location.pathname + window.location.search
229+
if (history.pushState) {
230+
history.pushState(null, null, currentPath + '#' + id)
231+
} else {
232+
// Fallback for older browsers
233+
window.location.hash = id
234+
}
226235
})
227236
}
228237
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/bootstrap-vue/bootstrap-vue/commit/5bb20ce28792aa29514ad4c435c63b7aec44a771

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy