Dialog sometimes doesn't open as a modal box (takes over the whole page)

Dialog sometimes doesn't open as a modal box (takes over the whole page)

Hi,

I'm using jquery ui dialog with the iframe modification:

Does anyone have the same problem: sometimes the dialog when opened, instead of being a box inside a page, opens the iframe url in whole browser (location changes to the iframe URL).

jquery ui 1.7.2
jquery 1.4.2