Don't execute commands from the shell when a modal dialog is open.

This is a temporary quick fix for #2616 

If a modal HTML dialog is open, don't execute commands that originate from the shell. The proper long-term solution is actually disabling command when a modal dialog is open, but that is a much bigger effort that should be a user story.