chore: Remove no longer neccessary useOnClickOutside (capture: true on InputSelect solved the same problem)

This commit is contained in:
Tom Moor
2024-02-01 18:03:03 -05:00
parent a21079a276
commit 554c3a87dc

View File

@@ -6,7 +6,6 @@ import breakpoint from "styled-components-breakpoint";
import { depths, s } from "@shared/styles";
import useKeyDown from "~/hooks/useKeyDown";
import useMobile from "~/hooks/useMobile";
import useOnClickOutside from "~/hooks/useOnClickOutside";
import { fadeAndScaleIn } from "~/styles/animations";
type Props = PopoverProps & {
@@ -30,7 +29,6 @@ const Popover: React.FC<Props> = ({
mobilePosition,
...rest
}: Props) => {
const contentRef = React.useRef<HTMLDivElement>(null);
const isMobile = useMobile();
// Custom Escape handler rather than using hideOnEsc from reakit so we can
@@ -48,16 +46,6 @@ const Popover: React.FC<Props> = ({
}
);
// Custom click outside handling rather than using `hideOnClickOutside` from reakit so that we can
// respect event.defaultPrevented.
useOnClickOutside(contentRef, (event) => {
if (rest.visible && !event.defaultPrevented) {
event.stopPropagation();
event.preventDefault();
rest.hide();
}
});
if (isMobile) {
return (
<Dialog {...rest} modal>
@@ -74,9 +62,8 @@ const Popover: React.FC<Props> = ({
}
return (
<ReakitPopover {...rest} hideOnEsc={false} hideOnClickOutside={false}>
<ReakitPopover {...rest} hideOnEsc={false} hideOnClickOutside>
<Contents
ref={contentRef}
$shrink={shrink}
$width={width}
$scrollable={scrollable}