MATLAB: How to clear stuck help popups

MATLABmatlab gui

2019a Matlab on Linux. Sometimes a help popup for a function (or similar) will pop up from the GUI and refuse to go away when it normally would. They continue to sit there and block what is behind them. It stays at a constant place on the screen, so I can sometimes move the window around to get my work done. Is there any way to clear them short of killing matlab and starting over? This is not on a figure, it's in the command window or editor.

Best Answer

Updates June 12, 2020:
  1. There is a recognized bug report on a very similar issue: https://www.mathworks.com/support/bugreports/1987277 - this bug report is about function hints, but presumably it's the same underlying problem as for help popups.
  2. The following code snippet is supposed to close any open help popups or function hints:
ws = com.mathworks.mwswing.window.MJFullWindowRegistry.windows;
while ws.hasMoreElements, w=ws.nextElement; if any(strcmp(w.getName,{'HelpPopup','FunctionHints'})),w.dispose,end, end
The "stuck popup" problem has annoyed me for years. I notice them, for example, if I display a large multi-line data-tip (or the code that's displayed when you hover the mouse above the "..." in folded code) in the editor and then switch to another editor file very quickly. The popup then gets stuck. As noted above, these popups are not a figure and no programmatic close of figures closes them.
My experience has been that the following combination of actions can sometimes (not always, nor predictably) assist:
  1. click the Esc key
  2. hover the mouse on top of another "..." of folded code
  3. switch to another editor file
  4. switch to another application that will hide (overlap) Matlab, and then switch back to Matlab
In the case of a function help, try clicking F1 to try to replace the persistent popup with a new one (that will hopefully be more well-behaved), then dismiss it in the normal way.
Unfortunately, I am not aware of a programmatic way to dismiss tooltip popups in the Editor.