diff --git a/src/index.ts b/src/index.ts index c076e4f..e0e45c0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,7 @@ import './styles.scss'; import { create } from './portfolio'; const addSupportForTabNavigation = () => - (document.onkeydown = e => { + document.addEventListener('keydown', e => { if (e.key === ' ') { (document.activeElement as HTMLElement)?.click(); e.preventDefault(); @@ -20,8 +20,11 @@ const addSupportForTabNavigation = () => }); const removeUnnecessaryOutlines = () => - (document.onclick = () => (document.activeElement as HTMLElement).blur?.()); + document.addEventListener('click', () => + (document.activeElement as HTMLElement).blur?.() + ); -create(); addSupportForTabNavigation(); removeUnnecessaryOutlines(); + +create();