Skip to content
Snippets Groups Projects
Commit 126100e9 authored by alexisben's avatar alexisben
Browse files

a11y action

parent f9a4d2fe
No related branches found
No related tags found
No related merge requests found
import { breakpoints } from '../utils/breakpoints';
import { a11yClick } from '../utils/a11y';
const CLASSES = {
mainMenuOpened: 'is-opened',
......@@ -33,7 +34,7 @@ class MainMenu {
});
this.dropdownsButtons.forEach((button) => {
button.addEventListener('click', (event) => {
a11yClick(button, (event) => {
event.preventDefault();
this.toggleDropdown(button);
});
......
const actionKeys = [
'Enter',
'Space'
];
const a11yClick = function(element, action) {
element.addEventListener('click', action);
element.addEventListener('keydown', (event) => {
console.log(event)
actionKeys.forEach(key => {
if (key === event.code) {
action(event);
}
})
});
}
export {
a11yClick
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment