Blank screen when switching to another iframe

My codemirror is embedded inside one of the iframes under different tab (using angularjs bootstrap tab facility).

When I switch to another tab and switch back, my codemirror editor screen is often blank and I have to click on the editor area to get it display but then I loose the cursor. It appears to always auto scroll to the top of the document as if it’s the first time the document is opened.

I tried turning off auto focus and that didn’t appear to make any difference.

Does anyone know what’s causing this issue?

Thanks for any help/hint you can provide.


CodeMirror needs to know its layout (which isn’t possible when it is hidden) to draw itself. You can call the refresh method after showing the editor to force a redraw.