Show a pop-up confirmation when user hits backspace on a specific page

I have a page which involves users interacting and editing data. Whilst testing, there's been a few instances where the backspace key will trigger the broswer to go back a page rather than delete data in a text field. Is there a way to show a confirmation pop-up window before navigating away from the page (so the user doesn't lose their progress)?

Hey @ollyds, sorry for the delay! You should be able to do this with Javascript:

The place to put this is in Settings under the Advanced tab. Let me know if this works!

How does one detect if a form is active though if there’s no access to the DOM (or components) from the sandbox? Guess one would need to manually add and remove the event handler whenever a form is opened, but that’s not a very nice solution, and still doesn’t enable to detect uncommitted changes in the form.

Hey there @lauri! What do you mean by if a form is “open”? Also are you using the form component or the JSON Schema form?