Add better event handlers
This commit is contained in:
parent
d07102077f
commit
6fc16f4de0
1 changed files with 6 additions and 3 deletions
|
|
@ -12,7 +12,7 @@ import './styles.scss';
|
||||||
import { create } from './portfolio';
|
import { create } from './portfolio';
|
||||||
|
|
||||||
const addSupportForTabNavigation = () =>
|
const addSupportForTabNavigation = () =>
|
||||||
(document.onkeydown = e => {
|
document.addEventListener('keydown', e => {
|
||||||
if (e.key === ' ') {
|
if (e.key === ' ') {
|
||||||
(document.activeElement as HTMLElement)?.click();
|
(document.activeElement as HTMLElement)?.click();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
@ -20,8 +20,11 @@ const addSupportForTabNavigation = () =>
|
||||||
});
|
});
|
||||||
|
|
||||||
const removeUnnecessaryOutlines = () =>
|
const removeUnnecessaryOutlines = () =>
|
||||||
(document.onclick = () => (document.activeElement as HTMLElement).blur?.());
|
document.addEventListener('click', () =>
|
||||||
|
(document.activeElement as HTMLElement).blur?.()
|
||||||
|
);
|
||||||
|
|
||||||
create();
|
|
||||||
addSupportForTabNavigation();
|
addSupportForTabNavigation();
|
||||||
removeUnnecessaryOutlines();
|
removeUnnecessaryOutlines();
|
||||||
|
|
||||||
|
create();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue