beforeRouteLeave thingy worked fine until I had two nested modals… A filters modal and a category picker modal inside it. The back button closes both of them.
I’d recommend avoiding nesting modals as it can result in a confusing user experience. If you can limit it to one open modal at a time that should let you workaround this browser limitation.