When DialogButtonModel disabled, the DialogButton's OnClick event is still triggered when press ENTER

Hi team,

I have a modal dialog with some form components and two buttons, one for confirm and the other for cancel. When the modal works, there are two unexpected issues:

1. Even though I made the confirm button model disabled like:

        <DialogButton OnClick="@DlgConfirm" Type="Submit">
            <DialogButtonModel Content="Confirm" IsPrimary="true" Disabled="true"></DialogButtonModel>
        </DialogButton>

when I'm typing in some form control (SfTextBox for instance), and pressing Enter, the DlgConfirm will be triggered unexpectedly. I think it's better to forbidden the button from being triggered when disabled.

2. When I press ESC at anytime on the modal, the "Closed" event is triggered, it make sense but, in the code I couldn't tell whether the modal was closed by confirming or canceling action since the args of "Closed" provide almost nothing useful, and I do need to execute some recover actions if it's a canceling. To dealing with the situation, I have to set up some variable to indicate the state, but it's a little ugly. I hope the modal could trigger cancel button's OnClick event when user press ESC, and it's indeed an expected action.

Could you please check for the two issues and give me a reply?

Thanks.

5 Replies 1 reply marked as answer

BR Brian June 16, 2020 09:40 AM UTC

The modal's "Closed" event I mentioned above is actually "OnClose", It's a slip of pen. Sorry for inconvenience, but the issue is the same.


IS Indrajith Srinivasan Syncfusion Team June 17, 2020 04:43 PM UTC

Hi Brian,  
  
Greetings from Syncfusion support, 
 
 We have validated your reported queries and below are the responses for it.  
 
Query 1: “I think it's better to forbidden the button from being triggered when disabled. 
  
We have validated your reported query. The reported issue occurs only if the SfDialog button is set as primary. We and have considered “Enter key action is performed with forms, even after the primary button is disabled” as a bug from our end and logged the report for the same and the fix will be included with our 2020 Volume 2 Main Release.

You can now track the current status of the report, review the proposed resolution timeline, and contact us for any further inquiries through this link: https://www.syncfusion.com/feedback/15319/
 
 
Query 2: “When I press ESC at anytime on the modal, the "Closed" event is triggered, it make sense but, in the code I couldn't tell whether the modal was closed by confirming or canceling action since the args of "Closed" provide almost nothing useful, and I do need to execute some recover actions if it's a canceling. To dealing with the situation, I have to set up some variable to indicate the state, but it's a little ugly. I hope the modal could trigger cancel button's OnClick event when user press ESC, and it's indeed an expected action. 
  
We have validated the reported query and have considered “Dialog OnClose event doesn't return the proper SfDialog close action” as a bug from our end and logged the report for the same and the fix will be included with our 2020 Volume 2 Main Release. 
 
You can now track the current status of the report, review the proposed resolution timeline, and contact us for any further inquiries through this link: https://www.syncfusion.com/feedback/15320/ 
 
Regards, 
Indrajith 



BR Brian June 17, 2020 11:55 PM UTC

Appreciate for your high efficiency. I will track the status.



IS Indrajith Srinivasan Syncfusion Team June 18, 2020 12:48 PM UTC

Hi Brian, 
 
Thanks for the update, 
 
We will let you know once the fix is included with the SfDialog. 
 
Regards, 
Indrajith 



IS Indrajith Srinivasan Syncfusion Team July 7, 2020 03:44 PM UTC

Hi Brian, 
 
Thanks for your patience, 

We have resolved the reported issues “Enter key action is performed with forms, even after the primary button is disabled” and “Dialog OnClose event doesn't return the proper SfDialog close action ” the fix is now available with the Nuget package version 18.2.44. Also, You can now detect the SfDialog close action in the OnClose eventArgs, using the ClosedBy argument which returns ("Escape"|| "Close Icon" || “User Action“) based on the SfDialog closed.

Release Notes: https://blazor.syncfusion.com/documentation/release-notes/18.2.44/?type=all#dialog
 

Can you please upgrade your package to this version to resolve the issue from your end?
 
 
Regards, 
Indrajith 


Marked as answer
Loader.
Up arrow icon