diff --git a/package.json b/package.json index 8148c08..cf91377 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webfactory-accordion", - "version": "5.0.1", + "version": "5.1.0", "description": "A tiny script that progressively enhances static HTML with accessible and keyboard-enabled accordion functionality.", "main": "src/main.js", "repository": { diff --git a/src/accordion.js b/src/accordion.js index 021da56..185a24a 100644 --- a/src/accordion.js +++ b/src/accordion.js @@ -107,13 +107,20 @@ class wfaccordion { }); // Update ARIA states on click/tap - this.trigger.addEventListener('click', (event) => { + this.trigger.addEventListener('click', () => { this.toggle(); if (!this.settings.disableHashUpdate) { this.updateHash(); } }); + + // Expand if being targeted by an in-page anchor link + this.trigger.addEventListener('focus', () => { + if (this.triggerId === getUrlHash()) { + this.expand(); + } + }) } } }