Despite supporting .val() and .textSelection (added by jquery.textSelection module) methods for $( '#wpTextbox1' ), CodeMirror has no support for .focus() & .blur() methods and corresponding events.
In Chrome, listening to these events for the .CodeMirror-code element saves the day, but for some reason the DOM for Chrome and Firefox (at least these two) differs, and in Firefox, I have found no reliable way to attach the said event listeners to the editing area. You can listen to .CodeMirror textarea which is present only in Firefox, but it isn't present in the DOM from the start, and—what makes the things even worse—there is no mw.hook events created for CodeMirror (see T174811: Support JavaScript hook events for CodeMirror), so you can't catch the moment when CodeMirror is initialized to attach a listener. mw.hook( 'wikipage.editform' ) is useless.
Because of this issue an important ruwiki script has broken in Firefox for many users after CodeMirror came out of beta last week.