Merge pull request #1493 from robintown/touchscreen-detection

Make touchscreen detection more robust
This commit is contained in:
Robin
2023-09-19 07:14:58 -04:00
committed by GitHub

View File

@@ -67,7 +67,9 @@ export function Modal({
...rest
}: ModalProps) {
const { t } = useTranslation();
const touchscreen = useMediaQuery("(hover: none)");
// Empirically, Chrome on Android can end up not matching (hover: none), but
// still matching (pointer: coarse) :/
const touchscreen = useMediaQuery("(hover: none) or (pointer: coarse)");
const onOpenChange = useCallback(
(open: boolean) => {
if (!open) onDismiss?.();