Attempt to fix menu sometimes not closeable on Mobile Safari

This commit is contained in:
Lim Chee Aun 2023-02-28 15:45:38 +08:00
parent 393a473649
commit 59cf6b2a58

View file

@ -339,6 +339,7 @@ function Status({
} }
}; };
const menuInstanceRef = useRef();
const StatusMenuItems = ( const StatusMenuItems = (
<> <>
{!isSizeLarge && ( {!isSizeLarge && (
@ -559,22 +560,28 @@ function Status({
{size !== 'l' && {size !== 'l' &&
(url ? ( (url ? (
<Menu <Menu
instanceRef={menuInstanceRef}
portal={{ portal={{
target: target:
document.querySelector('.status-deck') || document.body, document.querySelector('.status-deck') || document.body,
}} }}
containerProps={{
onClick: () => {
menuInstanceRef.current?.closeMenu?.();
},
}}
align="end" align="end"
offsetY={4} offsetY={4}
overflow="auto" overflow="auto"
viewScroll="close" viewScroll="close"
boundingBoxPadding="8 8 8 8" boundingBoxPadding="8 8 8 8"
unmountOnClose
menuButton={ menuButton={
<Link <Link
to={instance ? `/${instance}/s/${id}` : `/s/${id}`} to={instance ? `/${instance}/s/${id}` : `/s/${id}`}
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
console.log('click', e);
}} }}
class="time" class="time"
> >