mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Fix right click to show request actions (#6275)
This commit is contained in:
parent
9f6e2f3485
commit
8b642ea292
@ -2,7 +2,7 @@ import { PressResponder } from '@react-aria/interactions';
|
||||
import type { AriaMenuProps, MenuTriggerProps } from '@react-types/menu';
|
||||
import type { Placement } from '@react-types/overlays';
|
||||
import classnames from 'classnames';
|
||||
import React, { CSSProperties, forwardRef, ReactNode, useRef } from 'react';
|
||||
import React, { CSSProperties, forwardRef, ReactNode, useImperativeHandle, useRef } from 'react';
|
||||
import { mergeProps, useMenuTrigger } from 'react-aria';
|
||||
import { MenuTriggerState, useMenuTriggerState } from 'react-stately';
|
||||
import styled from 'styled-components';
|
||||
@ -53,6 +53,12 @@ export const Dropdown = forwardRef<DropdownHandle, DropdownProps>((props: Dropdo
|
||||
onOpenChange: isOpen => isOpen ? onOpen?.() : onClose?.(),
|
||||
});
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
show: () => state.open(),
|
||||
hide: () => state.close(),
|
||||
toggle: () => state.toggle(),
|
||||
}));
|
||||
|
||||
const triggerRef = useRef<HTMLButtonElement>(ref);
|
||||
|
||||
const { menuTriggerProps, menuProps } = useMenuTrigger({ isDisabled }, state, triggerRef);
|
||||
|
Loading…
Reference in New Issue
Block a user