I created those features, when I complete them using acceptCompletion() from @codemirror/autocompletion then everything works fine. But when I type in the full autocomplete detail, and the widget appears, then the autocomplete popup does some wierd jump and stays in that wierd position. I know this is a bug, because when I do literally anything (scroll, press just control, even adjust volume), then view updates and the popup goes down to the I assume correct position.
I prepared a minimal bug reproduction with emoji Decoration.widget() and autocomplete using completeFromList().
I recorded an example video. What I do in the video:
I type :smile to open emoji popup that works fine
in the video, I press : to type in the full label of the autocomplete
After I press it, the autocomplete does wierd jump
After that - I don’t interact with the editor at all, I simply increase volume on my PC using the volume button on my headphones.
I assume view refreshes and popup jumps to “correct” position
Notice that when I finish typing :, then chrome loads the image, and for a brief time, I believe the img created by widget has height 0 or auto, and that’s why the position is miscalculated.
This bug is very hard to reproduce, since I believe it only happens because <img> for brief moment has 0 height. On successive tries chrome will use image from cache, and that image actually right from the start will have to correct size. I was only able to reproduce the issue because I set Disable cache and throttle in chrome settings:
The event of the image loading and changing height is not detectable by the editor, leading to it using its old content size measurements until something else happens. I recommend either giving your icons a fixed size in CSS, or attaching a load handler that calls requestMeasure to them.
Can we add a line to CodeMirror Reference Manual documentation, mentioning that changing size of widget decoration doesn’t properly display on its own, and either static height or manual call to requestMeasure() is necessary.