feat: focus dialog after showing modal

This commit is contained in:
rabbitism
2024-07-27 18:20:40 +08:00
parent 4a68c7ce9f
commit fb0816b2c5
3 changed files with 4 additions and 0 deletions

View File

@@ -173,6 +173,7 @@ public partial class OverlayDialogHost
_modalCount++;
IsInModalStatus = _modalCount > 0;
control.IsClosed = false;
control.Focus();
}
// Handle dialog layer change event

View File

@@ -67,6 +67,8 @@ public partial class OverlayDialogHost
{
await Task.WhenAll(animation.RunAsync(control), _maskAppearAnimation.RunAsync(mask));
}
control.Focus();
}
private void SetDrawerPosition(DrawerControlBase control)

View File

@@ -20,6 +20,7 @@ public abstract class OverlayFeedbackElement: ContentControl
static OverlayFeedbackElement()
{
FocusableProperty.OverrideDefaultValue<OverlayFeedbackElement>(true);
DataContextProperty.Changed.AddClassHandler<OverlayFeedbackElement, object?>((o, e) => o.OnDataContextChange(e));
ClosedEvent.AddClassHandler<OverlayFeedbackElement>((o,e)=>o.OnClosed(e));
}