Stick header in proper scroll position when having a custom fixed topbar on top of it

Can you think of a way to do this which would work without having a fixed-height custom header?

We have a 2 line header which will wrap to 4 lines on narrow screens (e.g. mobile). I guess it could use a fixed height dependent on the screen width and a bit of guesswork. (Not perfect as the width of the content varies over time.)

It seems that the Discourse code has an oversight here. It calculates the height of the d-header element, but if you do anything in Admin/Customize/Themes/Header, it is inserted above d-header, in a separate non-child element, and that extra height is not considered when scrolling.

It seems like the height of a common parent element should be used, or the Customize header should be inserted as a child of d-header.

It looks like this recent fix/commit was for something similar, but it doesn’t seem to have affected my site, so it must be something slightly different:

https://github.com/discourse/discourse/commit/2fe2c1bfb9918ae1d49aa534027bf825a64bc4aa

For anyone who hasn’t seen the problem, this is what happens when you use the Customize/Header option:

This is what it looks like normally, without a custom header: