Making UI unclickable for web item

I am working on web item fragments and in “run code and open dialog” option, Is there a way to block the UI until the dialog is opened, Just like when clicked on transition button the UI will be un-clickable until dialog is appeared.