BottomSheet: fix click inner select trigger close
All checks were successful
/ depoly (push) Successful in 1m17s

This commit is contained in:
thislight 2024-11-07 16:17:42 +08:00
parent f15a52b3db
commit f965bb4002
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E

View file

@ -209,13 +209,13 @@ const BottomSheet: ParentComponent<BottomSheetProps> = (props) => {
const onDialogClick = (
event: MouseEvent & { currentTarget: HTMLDialogElement },
) => {
if (event.target !== event.currentTarget) return;
const rect = event.currentTarget.getBoundingClientRect();
const isInDialog =
rect.top <= event.clientY &&
event.clientY <= rect.top + rect.height &&
rect.left <= event.clientX &&
event.clientX <= rect.left + rect.width;
if (!isInDialog) {
const isNotInDialog = event.clientY < rect.top ||
event.clientY > (rect.bottom) ||
event.clientX < rect.left ||
event.clientX > rect.right;
if (isNotInDialog) {
props.onClose?.("backdrop");
}
};