Merge branch 'fix-pointer-events-bug' into 'develop'
Close dropdown-menu when component unmounts See merge request soapbox-pub/soapbox!2284
This commit is contained in:
commit
9b74f9264d
|
@ -64,7 +64,7 @@ const DropdownMenuItem = ({ index, item, onClick }: IDropdownMenuItem) => {
|
||||||
const firstItem = index === 0;
|
const firstItem = index === 0;
|
||||||
|
|
||||||
if (itemRef.current && firstItem) {
|
if (itemRef.current && firstItem) {
|
||||||
itemRef.current.focus();
|
itemRef.current.focus({ preventScroll: true });
|
||||||
}
|
}
|
||||||
}, [itemRef.current, index]);
|
}, [itemRef.current, index]);
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,11 @@ const DropdownMenu = (props: IDropdownMenu) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
dispatch(closeDropdownMenu());
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.addEventListener('click', handleDocumentClick, false);
|
document.addEventListener('click', handleDocumentClick, false);
|
||||||
|
|
Loading…
Reference in New Issue