Apply 2 suggestion(s) to 1 file(s)

dnd
Justin 2022-05-31 15:03:41 +00:00 zatwierdzone przez Alex Gleason
rodzic 4bbc6d02b7
commit 07ce1b4873
1 zmienionych plików z 2 dodań i 4 usunięć

Wyświetl plik

@ -39,7 +39,7 @@ const PrivacyDropdownMenu: React.FC<IPrivacyDropdownMenu> = ({ style, items, pla
const node = useRef<HTMLDivElement>(null); const node = useRef<HTMLDivElement>(null);
const focusedItem = useRef<HTMLDivElement>(null); const focusedItem = useRef<HTMLDivElement>(null);
const [mounted, setMounted] = useState(false); const [mounted, setMounted] = useState<boolean>(false);
const handleDocumentClick = (e: MouseEvent | TouchEvent) => { const handleDocumentClick = (e: MouseEvent | TouchEvent) => {
if (node.current && !node.current.contains(e.target as HTMLElement)) { if (node.current && !node.current.contains(e.target as HTMLElement)) {
@ -49,9 +49,7 @@ const PrivacyDropdownMenu: React.FC<IPrivacyDropdownMenu> = ({ style, items, pla
const handleKeyDown: React.KeyboardEventHandler = e => { const handleKeyDown: React.KeyboardEventHandler = e => {
const value = e.currentTarget.getAttribute('data-index'); const value = e.currentTarget.getAttribute('data-index');
const index = items.findIndex(item => { const index = items.findIndex(item => item.value === value);
return (item.value === value);
});
let element = null; let element = null;
switch (e.key) { switch (e.key) {