mirror of
https://github.com/jbowdre/virtuallypotato.git
synced 2024-11-22 23:12:19 +00:00
13 lines
334 B
JavaScript
13 lines
334 B
JavaScript
|
// Make the collapsible content accessible
|
||
|
let myLabels = document.querySelectorAll('.lbl-toggle');
|
||
|
|
||
|
Array.from(myLabels).forEach(label => {
|
||
|
label.addEventListener('keydown', e => {
|
||
|
// 32 === spacebar
|
||
|
// 13 === enter
|
||
|
if (e.which === 32 || e.which === 13) {
|
||
|
e.preventDefault();
|
||
|
label.click();
|
||
|
};
|
||
|
});
|
||
|
});
|