fix(module: dialog): click dialog cause the mask click event triggered (#1727)

This commit is contained in:
zxyao 2021-07-12 23:27:09 +08:00 committed by GitHub
parent 300123045f
commit d07e3cb8fc
2 changed files with 11 additions and 12 deletions

View File

@ -9,7 +9,6 @@
}
<div tabindex="-1" id=@($"{Config.PrefixCls}-wrap_{DialogWrapperId}") class=@($"{Config.PrefixCls}-wrap {Config.GetWrapClassNameExtended()}") role="dialog"
@onclick="@EventUtil.AsNonRenderingEventHandler(OnMaskClick)"
@onmouseup="@EventUtil.AsNonRenderingEventHandler(OnMaskMouseUp)"
@onkeydown="@OnKeyDown"
style="@_wrapStyle">
<div @ref="@_modal" role="document" class=@($"{Config.PrefixCls} {GetModalClsName()}")

View File

@ -138,20 +138,20 @@ namespace AntDesign
_dialogMouseDown = true;
}
private async Task OnMaskMouseUp()
{
if (Config.MaskClosable && _dialogMouseDown)
{
await Task.Delay(4);
_dialogMouseDown = false;
}
}
private async Task OnMaskClick()
{
if (Config.MaskClosable && !_dialogMouseDown)
if (Config.MaskClosable)
{
await CloseAsync();
if (_dialogMouseDown)
{
// mask area union dialog area is clicked.
_dialogMouseDown = false;
}
else
{
// mask area erased by dialog area is clicked.
await CloseAsync();
}
}
}