No coverage whatsoever. Unit test properly.
Just a function, 22LOC. Relies in a lot of global state.
Also, please remove // HACK: This is a temporary fix, because it clearly is not. Disabling navigation popups in hovercards is a feature, at least while navigation popups exists.