It could go either way, I suppose. I was thinking that the modal should be canceled, but right now that doesn't do anything but hide. If you have a strong feeling about it I can switch it.

I like the idea about making a helper that does the tests, e.g. a new method called cancelModalIfShowing. I'll make that change.