1

I am using Monaco Editor 0.22.3 in combination with StencilJS and TailwindCSS. Everything works great, except for an annoying visual glitch in the intellisense dropdown as depicted here:

enter image description here

As you can see, the last suggested item is partially obscured. I suspect it might have something to do with some style coming from TailwindCSS, but I'm pretty much at my wits end here. I tried to use the F12 element inspector to see if I can find some hints, but that is proving to be close to impossible since the intellisense dropdown disappears as soon as it loses focus.

Any hints would be much appreciated!

UPDATE 1

Here's a screenshot with a bigger editor to demonstrate that the dropdown itself does not appear to be clipped:

enter image description here

UPDATE 2

Here's an animated gif showing the issue when trying to debug the HTML elements using the browser developer tools:

enter image description here

As you can see, the dropdown disappears as soon as I click anywhere else.

Sipke Schoorstra
  • 3,074
  • 1
  • 20
  • 28

2 Answers2

2

The issue comes from a fairly common css class being used: .tree. Libraries such as tailwindcss add padding-bottom to it for example. To undo some of its additions for the monaco editor we added the following to our css file:

.monaco-editor .suggest-widget div.tree {
    white-space: unset;
    padding-bottom: 0;
}

And to get get to that solution for other libraries and styling artefacts:

It should have been quite easy but the suggestion dialog has a tendency to hide when we try to observe it. so a UI guy and I spent a while going through the playbook to try to debug it. The only successful way to inspect it was to abuse the JS debugger by running (which was a hint from a stack overflow post that I'm struggling to find to give credit), and just cause the JS engine to pause:

Run:

setTimeout(5000);

This gives us 5 seconds to get the suggestion window to show (or set to a relative amount of time to the problem). After which, you could mostly inspect it as normal with a quick shortcut:

ctrl+shift+c that brings up the debuggers element selector.

Here we are, the suggestion was from the following post: How can I inspect disappearing element in a browser?

break on subtree probably would have worked, but we became a bit impatient stepping through the changes. ctrl+ / didn't seem to help in this case, which left the odd setTimout to save the day.

Matthew
  • 412
  • 4
  • 16
  • Beautiful. Not only did the CSS rules work perfectly, the tricks about dealing with inspecting disappearing elements is going to prove useful going forward. – Sipke Schoorstra Apr 15 '21 at 09:18
0

The drop down is clipped at the editor's boundaries. I actually wonder how you can see the last empty part outside of the editor.

For inspection: use your browser's dev tools to see how the containers overlap. This will avoid that the editor hides the drop down.

Update

After your update I think now that somehow the styles are messed up. You will have to figure out a way to show the popup and still navigate the DOM tree in the developer tools. Try to locate the parent and see if that popup is only hidden (it still shows up then in the tree) or if it is dynamically created or is a portal, which lives in a completely different part of the tree.

If that cannot be done then try to disable all CSS you have and see if that solves the issue. If so enable the CSS piece by piece to find the culprit.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
  • It doesn't appear that way. When I increase the height of the editor, I am still seeing the issue (I'll update my question with a screenshot). – Sipke Schoorstra Mar 01 '21 at 18:21
  • As mentioned, I already tried the browser's dev tools (I referred to them as the F12 element inspector; I can see that term might be insufficient or incorrect). I'll add an animation to demonstrate what I'm up against. – Sipke Schoorstra Mar 01 '21 at 18:26