Skip to content

Commit

Permalink
Merge pull request #1094 from City-of-Helsinki/UHF-X_sentry_anchor_sy…
Browse files Browse the repository at this point in the history
…ntaxError

UHF-X sentry anchor syntax error
  • Loading branch information
Arkkimaagi authored Oct 28, 2024
2 parents f53f1ef + 3f9cdd1 commit 1818c4d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/js/accordion.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/js/accordion/accordion-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class AccordionItem {
};

handleLinkAnchor = (urlHash) => {
if (!urlHash) return;
if (!urlHash || urlHash.length === 0) return;
const item = this.element.querySelector(urlHash);
if (item) {
this.open();
Expand Down
5 changes: 4 additions & 1 deletion src/js/accordion/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export default class Events {

static handleTableOfContentsHash = () => {
window.addEventListener('hashchange', () => {
const {hash} = window.location;
const { hash } = window.location;
if(!hash || hash.length < 2) {
return;
}

// Look for accordion headers for anchor links.
let accordionItemFound = false;
Expand Down

0 comments on commit 1818c4d

Please sign in to comment.