Fix custom gradient keyboard mode

This commit is contained in:
Josh Perez 2023-05-01 15:05:39 -04:00 committed by GitHub
parent a1c7634f23
commit 6154b83720
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View file

@ -20,6 +20,10 @@
}
}
&__modal__body.module-Modal__body {
overflow-x: hidden;
}
&__bubbles {
align-items: center;
display: grid;

View file

@ -244,17 +244,21 @@ export function GradientDial({
};
const handleKeyDown = (ev: KeyboardEvent) => {
let add = 1;
if (ev.key === 'ArrowDown' || ev.key === arrow('start')) {
add = 1;
onChange(Math.min(360, Math.max(0, deg + 1)));
}
if (ev.key === 'ArrowUp' || ev.key === arrow('end')) {
add = -1;
onChange(Math.min(360, Math.max(0, deg - 1)));
}
onChange(Math.min(360, Math.max(0, deg + add)));
if (ev.key === 'Enter' && ev.target instanceof HTMLElement) {
if (ev.target.ariaLabel === '0') {
onClick(KnobType.start);
} else if (ev.target.ariaLabel === '1') {
onClick(KnobType.end);
}
}
};
useEffect(() => {