mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
refactor: Stop using the deprecated keyCode (#2426)
Co-authored-by: Lipis <lipiridis@gmail.com> Co-authored-by: David Luzar <luzar.david@gmail.com>
This commit is contained in:
parent
58fcb44de0
commit
014097a97e
21 changed files with 257 additions and 281 deletions
|
@ -2,7 +2,7 @@ import React from "react";
|
|||
import { Popover } from "./Popover";
|
||||
|
||||
import "./ColorPicker.scss";
|
||||
import { KEYS } from "../keys";
|
||||
import { isArrowKey, KEYS } from "../keys";
|
||||
import { t, getLanguage } from "../i18n";
|
||||
import { isWritableElement } from "../utils";
|
||||
import colors from "../colors";
|
||||
|
@ -59,8 +59,7 @@ const Picker = ({
|
|||
const colorInput = React.useRef<HTMLInputElement>();
|
||||
|
||||
React.useEffect(() => {
|
||||
// After the component is first mounted
|
||||
// focus on first input
|
||||
// After the component is first mounted focus on first input
|
||||
if (activeItem.current) {
|
||||
activeItem.current.focus();
|
||||
} else if (colorInput.current) {
|
||||
|
@ -82,12 +81,7 @@ const Picker = ({
|
|||
firstItem.current?.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
} else if (
|
||||
event.key === KEYS.ARROW_RIGHT ||
|
||||
event.key === KEYS.ARROW_LEFT ||
|
||||
event.key === KEYS.ARROW_UP ||
|
||||
event.key === KEYS.ARROW_DOWN
|
||||
) {
|
||||
} else if (isArrowKey(event.key)) {
|
||||
const { activeElement } = document;
|
||||
const isRTL = getLanguage().rtl;
|
||||
const index = Array.prototype.indexOf.call(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue