chore: Remove no longer neccessary useOnClickOutside (capture: true on InputSelect solved the same problem)
This commit is contained in:
@@ -6,7 +6,6 @@ import breakpoint from "styled-components-breakpoint";
|
|||||||
import { depths, s } from "@shared/styles";
|
import { depths, s } from "@shared/styles";
|
||||||
import useKeyDown from "~/hooks/useKeyDown";
|
import useKeyDown from "~/hooks/useKeyDown";
|
||||||
import useMobile from "~/hooks/useMobile";
|
import useMobile from "~/hooks/useMobile";
|
||||||
import useOnClickOutside from "~/hooks/useOnClickOutside";
|
|
||||||
import { fadeAndScaleIn } from "~/styles/animations";
|
import { fadeAndScaleIn } from "~/styles/animations";
|
||||||
|
|
||||||
type Props = PopoverProps & {
|
type Props = PopoverProps & {
|
||||||
@@ -30,7 +29,6 @@ const Popover: React.FC<Props> = ({
|
|||||||
mobilePosition,
|
mobilePosition,
|
||||||
...rest
|
...rest
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const contentRef = React.useRef<HTMLDivElement>(null);
|
|
||||||
const isMobile = useMobile();
|
const isMobile = useMobile();
|
||||||
|
|
||||||
// Custom Escape handler rather than using hideOnEsc from reakit so we can
|
// 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) {
|
if (isMobile) {
|
||||||
return (
|
return (
|
||||||
<Dialog {...rest} modal>
|
<Dialog {...rest} modal>
|
||||||
@@ -74,9 +62,8 @@ const Popover: React.FC<Props> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ReakitPopover {...rest} hideOnEsc={false} hideOnClickOutside={false}>
|
<ReakitPopover {...rest} hideOnEsc={false} hideOnClickOutside>
|
||||||
<Contents
|
<Contents
|
||||||
ref={contentRef}
|
|
||||||
$shrink={shrink}
|
$shrink={shrink}
|
||||||
$width={width}
|
$width={width}
|
||||||
$scrollable={scrollable}
|
$scrollable={scrollable}
|
||||||
|
|||||||
Reference in New Issue
Block a user