can we make this more generic? there are ways of using dialogs in codemirror that will also trigger blur events