diff --git a/web/components/issues/issue-layouts/filters/header/helpers/dropdown.tsx b/web/components/issues/issue-layouts/filters/header/helpers/dropdown.tsx index 518403ee1..425f53b46 100644 --- a/web/components/issues/issue-layouts/filters/header/helpers/dropdown.tsx +++ b/web/components/issues/issue-layouts/filters/header/helpers/dropdown.tsx @@ -1,10 +1,7 @@ -import React, { Fragment, useRef, useState } from "react"; +import React, { Fragment, useState } from "react"; import { usePopper } from "react-popper"; -import { Popover } from "@headlessui/react"; +import { Popover, Transition } from "@headlessui/react"; import { Placement } from "@popperjs/core"; -// hooks -import { useDropdownKeyDown } from "hooks/use-dropdown-key-down"; -import useOutsideClickDetector from "hooks/use-outside-click-detector"; // ui import { Button } from "@plane/ui"; // icons @@ -23,24 +20,13 @@ export const FiltersDropdown: React.FC = (props) => { const [referenceElement, setReferenceElement] = useState(null); const [popperElement, setPopperElement] = useState(null); - const [isOpen, setIsOpen] = useState(false); - // refs - const dropdownRef = useRef(null); const { styles, attributes } = usePopper(referenceElement, popperElement, { placement: placement ?? "auto", }); - const openDropdown = () => { - setIsOpen(true); - if (referenceElement) referenceElement.focus(); - }; - const closeDropdown = () => setIsOpen(false); - const handleKeyDown = useDropdownKeyDown(openDropdown, closeDropdown, isOpen); - useOutsideClickDetector(dropdownRef, closeDropdown); - return ( - + {({ open }) => { if (open) { } @@ -55,15 +41,23 @@ export const FiltersDropdown: React.FC = (props) => { appendIcon={ } - onClick={openDropdown} + tabIndex={tabIndex} >
{title}
- {isOpen && ( - + +
= (props) => {
{children}
- )} +
); }}