Skip to content

Commit

Permalink
fix(a11y): nav-link anchor set focus on target
Browse files Browse the repository at this point in the history
  • Loading branch information
PiemP authored Sep 25, 2023
1 parent 2aa1234 commit 51d69cf
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/js/plugins/navscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ class NavScroll extends BaseComponent {
}

SelectorEngine.find(SELECTOR_LINK_CLICKABLE, this._element).forEach((link) => {
link.addEventListener('click', (event) => {
event.preventDefault()
link.addEventListener('click', () => {
const scrollHash = () => this._scrollToHash(link.hash)
if (this._isCollapseOpened) {
this._callbackQueue.push(scrollHash)
Expand Down Expand Up @@ -245,11 +244,9 @@ class NavScroll extends BaseComponent {
* ------------------------------------------------------------------------
*/

onDocumentScroll(() => {
const navs = SelectorEngine.find(SELECTOR_NAVSCROLL)
navs.map((nav) => {
NavScroll.getOrCreateInstance(nav)
})
const navs = SelectorEngine.find(SELECTOR_NAVSCROLL)
navs.map((nav) => {
NavScroll.getOrCreateInstance(nav)
})

export default NavScroll

0 comments on commit 51d69cf

Please sign in to comment.