Update to allow tab and space or enter to select a tab and change copyright info
This commit is contained in:
parent
a60f831900
commit
140b239cfc
@ -1,8 +1,14 @@
|
||||
/* DS2 core (c) 2024 Alexander McIlwraith
|
||||
import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js";
|
||||
tabs.init();
|
||||
Released under Creative Commons Attribution-ShareAlike 4.0 International
|
||||
*/
|
||||
|
||||
// create a pure JS mouse click event
|
||||
const click = new MouseEvent('click', {
|
||||
view: window,
|
||||
bubbles: false,
|
||||
cancelable: true
|
||||
});
|
||||
|
||||
export function init(p = document) {
|
||||
p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
||||
|
||||
@ -46,8 +52,15 @@ export function init(p = document) {
|
||||
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||
document.getElementById(tabPanelId).classList.add("open");
|
||||
});
|
||||
|
||||
|
||||
tab.addEventListener("keypress", (e) => {
|
||||
e.preventDefault();
|
||||
if( e.which == 32 || e.which == 13 ) {
|
||||
e.currentTarget.dispatchEvent(click);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user