Only hide modal on transitionend if the event originates from the modal;...

... fixes #13223

Needs testing from @spotts-ce, as I myself cannot reproduce the problem he is encountering.

/cc @fat @cvrebert