Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
9 changes: 8 additions & 1 deletion src/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
})
}
}
}
Expand Down