sforkowany z mirror/soapbox
Apply 2 suggestion(s) to 1 file(s)
rodzic
4bbc6d02b7
commit
07ce1b4873
|
@ -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) {
|
||||||
|
|
Ładowanie…
Reference in New Issue