Data-save-bar how to prevent form submission

Hi All,

I am using the data-save-bar and have a required text-field within my form

<form onSubmit={handleSave} onReset={handleDiscard} data-save-bar data-discard-confirmation>

the field is in the error state the save bar is being shown, but I want to prevent the save if the text field is still in the error state. Given that I am handling the form submission via my handlSave method how to I prevent the form from being submitted and get that little “wiggle” effect that I see in the admin when something is invalid.

Cheers,

Gary

You can try using:

shopify.saveBar.leaveConfirmation();