This is fixed per:
https://github.com/discourse/discourse/commit/8c1d145f0eaa8539a920c44537c0a64192650e1d
This also removes the 3 times a charm hack so cause I want to see if it is actually needed, can not repro a problem with it.
The issue was actually quite straightforward .height() in the new jQuery returns undefined if you call it on a non element whereas in the past it returned 0, I guess it is more correct now, but we need to be careful.
I also corrected some calculations that incorrectly accounted for title height and normalized keyboard shortcuts and highlight so they behave in the same way.