Use open-color directly (#1371)

This commit is contained in:
Jed Fox 2020-04-10 18:09:29 -04:00 committed by GitHub
parent 6d30351164
commit f7e3ee2064
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 3283 additions and 197 deletions

View file

@ -6,7 +6,7 @@ type Props = {
top?: number;
left?: number;
children?: React.ReactNode;
onCloseRequest?(): void;
onCloseRequest?(event: PointerEvent): void;
fitInViewport?: boolean;
};
@ -38,9 +38,9 @@ export function Popover({
useEffect(() => {
if (onCloseRequest) {
const handler = (e: Event) => {
if (!popoverRef.current?.contains(e.target as Node)) {
unstable_batchedUpdates(() => onCloseRequest());
const handler = (event: PointerEvent) => {
if (!popoverRef.current?.contains(event.target as Node)) {
unstable_batchedUpdates(() => onCloseRequest(event));
}
};
document.addEventListener("pointerdown", handler, false);