Skip to content

Commit

Permalink
Made action menu always present in DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
KitoC committed Aug 6, 2024
1 parent 984c98e commit e18a99e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 26 deletions.
58 changes: 35 additions & 23 deletions lib/components/ActionsMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ const crossTransform2 = keyframes`
}
`;

const StyledActionsMenuContainer = styled.div`
pointer-events: none;
opacity: 0;
transition: all 200ms ease-in-out;
transition-delay: 200ms;
&.visible {
opacity: 1;
pointer-events: auto;
}
`;

const Wrapper = styled.div`
${space}
${layout}
Expand Down Expand Up @@ -319,31 +331,31 @@ export const ActionsMenuBody = ({
<Wrapper {...props}>
{triggerComponent}

{actionMenu.context.open && (
<FloatingPortal
root={getFloatingUiRootElement(actionMenu.refs.reference)}
<FloatingPortal
root={getFloatingUiRootElement(actionMenu.refs.reference)}
>
<FloatingFocusManager
context={actionMenu.context}
modal={actionMenu.modal}
>
<FloatingFocusManager
context={actionMenu.context}
modal={actionMenu.modal}
<StyledActionsMenuContainer
ref={ref}
style={{
...actionMenu.floatingStyles,
zIndex: getFloatingUiZIndex(actionMenu.refs.reference)
}}
aria-labelledby={actionMenu.labelId}
{...actionMenu.getFloatingProps(props)}
className={`actionMenu-content ${
actionMenu.context.open ? "visible" : ""
}`}
>
<div
ref={ref}
style={{
...actionMenu.floatingStyles,
zIndex: getFloatingUiZIndex(actionMenu.refs.reference)
}}
aria-labelledby={actionMenu.labelId}
{...actionMenu.getFloatingProps(props)}
className="actionMenu-content"
>
<Menu menuWidth={menuWidth} isOpen={toggleState} role="list">
{children}
</Menu>
</div>
</FloatingFocusManager>
</FloatingPortal>
)}
<Menu menuWidth={menuWidth} isOpen={toggleState} role="list">
{children}
</Menu>
</StyledActionsMenuContainer>
</FloatingFocusManager>
</FloatingPortal>
</Wrapper>
</ActionMenuContext.Provider>
);
Expand Down
10 changes: 7 additions & 3 deletions lib/components/Popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,20 @@ export default function Popover({

const triggerProps = {
...getReferenceProps({
ref: refs.setReference,
"data-testid": dataTestId
ref: refs.setReference
})
};

let triggerComponent = null;

if (variant === "tooltip") {
triggerComponent = (
<TooltipControl {...triggerProps} active={visible} tabIndex="0">
<TooltipControl
data-testid={dataTestId}
{...triggerProps}
active={visible}
tabIndex="0"
>
<Icon
transform="grow-4"
icon={["fas", "question-circle"]}
Expand Down

0 comments on commit e18a99e

Please sign in to comment.