Fix context menu bugs

- It got mounted initially, need to set state to undefinde
- Missing zIndex
- Context menu got disabled on large status
This commit is contained in:
Lim Chee Aun 2023-03-02 20:37:40 +08:00
parent 4d59e5a804
commit d0953a321a

View file

@ -506,6 +506,7 @@ function Status({
}`} }`}
onMouseEnter={debugHover} onMouseEnter={debugHover}
onContextMenu={(e) => { onContextMenu={(e) => {
if (size === 'l') return;
if (e.metaKey) return; if (e.metaKey) return;
e.preventDefault(); e.preventDefault();
setContextMenuAnchorPoint({ setContextMenuAnchorPoint({
@ -515,20 +516,28 @@ function Status({
setIsContextMenuOpen(true); setIsContextMenuOpen(true);
}} }}
> >
<ControlledMenu {size !== 'l' && (
state={isContextMenuOpen ? 'open' : 'closed'} <ControlledMenu
anchorPoint={contextMenuAnchorPoint} state={isContextMenuOpen ? 'open' : undefined}
direction="right" anchorPoint={contextMenuAnchorPoint}
onClose={() => setIsContextMenuOpen(false)} direction="right"
portal={{ onClose={() => setIsContextMenuOpen(false)}
target: document.body, portal={{
}} target: document.body,
overflow="auto" }}
boundingBoxPadding="8 8 8 8" containerProps={{
unmountOnClose style: {
> // Higher than the backdrop
{StatusMenuItems} zIndex: 1001,
</ControlledMenu> },
}}
overflow="auto"
boundingBoxPadding="8 8 8 8"
unmountOnClose
>
{StatusMenuItems}
</ControlledMenu>
)}
{size !== 'l' && ( {size !== 'l' && (
<div class="status-badge"> <div class="status-badge">
{reblogged && <Icon class="reblog" icon="rocket" size="s" />} {reblogged && <Icon class="reblog" icon="rocket" size="s" />}