Hi Admir,
Greetings from Syncfusion support,
We have validated your reported query. Focusing of the primary button in the SfDialog is the default behavior, unless the SfDialog doesn’t have any focusable elements inside it. In order to prevent the enter key action, we suggest you to disable the SfDialog focusing in the Opened event. Check the below code blocks for reference.
|
@using Syncfusion.Blazor.Popups
@using Syncfusion.Blazor.Buttons
<SfButton @onclick="@OpenDialog">Open Dialog</SfButton>
<SfDialog Width="250px" ShowCloseIcon="true" IsModal="true" @bind-Visible="@IsVisible">
<DialogEvents Opened="@onOpen"></DialogEvents>
<DialogTemplates>
<Header> Dialog </Header>
<Content> This is a Dialog with button and primary button </Content>
</DialogTemplates>
<DialogButtons>
<DialogButton Content="OK" IsPrimary="true" OnClick="@CloseDialog" />
<DialogButton Content="Cancel" OnClick="@CloseDialog" />
</DialogButtons>
</SfDialog>
@code {
private bool IsVisible { get; set; } = true;
private void OpenDialog()
{
this.IsVisible = true;
}
private void CloseDialog()
{
this.IsVisible = false;
}
public void onOpen(OpenEventArgs args)
{
args.PreventFocus = true;
}
}
|
Please let us know if the solution helps,
Regards,
Indrajith