Started working with new web-component Polaris and “data-discard-confirmation” doesn’t work at all inside s-app-window nor outside it.
Hey @webx47 - thanks for flagging.
Just to double-check—are you using the data-discard-confirmation attribute on a form that also has the data-save-bar attribute? My understanding is that the discard confirmation only works when both attributes are on the same <form> element, since it needs the save bar to trigger the confirmation modal. Here’s the docs on forms with save bar that shows how they work together. Let me know if you’re still seeing the issue after checking though and I’m happy to take a look.
Yes i tried it with form + both attributes on it.
Hey @webx47 - thanks for confirming. Would you be able to share a code snippet showing how you’re setting up the form and whether you have the App Bridge script tag included? If you’d prefer not to share publicly, just let me know and I can set up a DM with you so you can share with the code snippet privately and I can take a closer look. Also, are you seeing any errors in your browser’s console when you click the discard button?
Hey @Alan_G, thanks for getting back to me on this. You can try this small code snippet—according to the docs, it should show a discard confirmation, but that’s not happening on my end.
I do see the save bar appear, which means data-save-bar is working, but the discard confirmation isn’t triggering.
Also, I’d like to know how I can use discard-confirmation with the alternative to the App Bridge modal, which is s-app-window.
<form data-save-bar data-discard-confirmation>
<s-text-field
label="Product Title"
name="title"
required
></s-text-field>
<s-text-area label="Description" name="description"></s-text-area>
</form>
Hey @webx47 - thanks for the snippet, really appreciated. I think I’ve been able to replicate this behaviour. Could you let me know if the issue you’re seeing is the same as in my replication below?
Once I hear back, I’ll look into this more deeply internally, but just wanted to confirm before I did, hope to hear from you soon!
Yes it’s working same as the video you have shared, there’s no discard confirmation.
Thanks @webx47 , appreciate you confirming. I’ll dig into this further for you on my end here and loop back with you once I have more info to share. Appreciate your patience on this!
Hey @webx47 - just following up. Improvements for the s-app-window are on our radar. I don’t have a turnaround time at the moment, but I’ll keep an eye on things and get in touch with you here once I can share more info.
Thanks @Alan_G.
Also, does the same status apply to the bug where form + data discard isn’t working?
Hey @webx47 - no problem! My understanding is that this issue we’re seeing is related to the improvement work we’re working on, but I’ll keep you updated here as soon as I have more to share. Appreciate you clarifying ![]()
Hey @webx47
- just reaching back out here with an update. I was able to confirm that this is actually expected behaviour at the moment. The discard confirmation functionality has been deprecated since 2024, however the behaviour was still referenced in our documentation and we’re looking into updating this.
Let me know if I can clarify anything more on my end here, hope this helps and thanks for bearing with me.
@Alan_G, is there a planned alternative solution for this, or will discard-confirmation and app-window close-confirmation no longer be doable?
Hi @Alan_G — you mentioned that the discard confirmation functionality has been deprecated. I recently applied for the BFS, and the team is asking me to add this discard behavior. How should I handle this given the deprecation?
Could you also reach out to the team to let them know this functionality is deprecated?
Hey @webx47 - thanks for sharing that screenshot, happy to look into this on my end for sure. Would you be open to sharing a ticket Id with me if you have one on hand from our BFS folks? Let me know if you’d prefer for me to DM you though so you can share that info and I can get that set up on my end. Hope to hear from you soon!
Hi @Alan_G here is the ticket number: 62831896 on this topic.
Thanks @webx47 - apologies for the delay over the holidays here, still looking into this on my end here, will loop back with you once I have more info to share.
Hi @Alan_G any update on this? waiting for your response before reapplying for the BFS.
I ran into this and solved it by making the app itself check the discard before actually submitting it. Not pretty but worked consistantly and the user wouldn’t know the difference
Hey folks - just following up on this. Our guidance for save bar interaction is here:
We don’t explicitly require the use of data-discard-confirmation , just functionality so that when the CSB is present, a merchant isn’t able to navigate away from the corresponding form without first being forced to interact with the CSB’s “Save” or “Discard” buttons. Hope this clarifies things, let me know if I can help out further.
