When I have to do some things repeatedly it’s good indication that I should share this in a blog post. This time it's quick one and I’m sure that it will be fixed by Shakeeb in next the APEX (Universal theme) version.
There’s a problem in APEX 5.1.0.00.45 UT when you call confirm/alert dialog with apex.message JS API from modal page. The problem is that you can close modal page before closing confirm/alert dialog.
You can fix this by adding this CSS block to your custom CSS files or to Theme Roller’s Custom CSS property:
Demo is available here.