Editor height = 0 in a <details> tag

Hi

use CodeMirror inside a ‘details’ tag, so, and it seems to be a correct behaviour, the editor height is set to 0 before the ‘details’ is unfolded…

But so I actually have to click in the textarea to let the editor reach a “normal” size…another problem is the code lines are shifted to the left, passing above the line numbers, until this number reaches ‘10’ and the gap disappear.

I understand these problems have to do with a “scroll” function in the codemirror.js; I assume a goal of this function is, among other things :-), precisely to keep the editor height in a “usable” height…

But I can’t find out what I have to tweak to get rid of both of the problems. CSS ? JS ?

Have you any advice ? Thank you very much in advance

The editor needs to be able to measure its dimensions in order to properly draw itself. So if you initialize it in a hidden place and then show it, you have to somehow arrange for its refresh method to be called after it becomes visible.

Thank a lot for your answer…

“refresh” was the clue; I just add the ‘autorefresh’ addon and it solved my issue.