Header submenus theme component pushes bottom of sidebar out of the screen

When the header submenus theme component is active, the icons at the bottom of the sidebar disappear from the screen.

There is probably some kind of CSS calculation going the wrong way?

3 Likes

Custom headers arenā€™t included in the calculation at all, this can be reproā€™d by adding any content to the header section of a theme.

The calculation we use for the sidebar and chat takes into consideration the height of the Discourse header and sets --header-offset as a variable when calculating some heights.

Including custom headers might be a little tricky because custom header content doesnā€™t stick on scroll by default like the Discourse header doesā€¦ so if we include it in the calculation by default, once you scroll and the custom header is gone, the height is then incorrect.

So for example, if I manually increase --header-offset by the height of my custom header (itā€™s roughly 60px by default), you get a gap above the sidebar on scroll:

We add a .docked class to the body once a custom header is scrolled out of view, so itā€™s possible to use thisā€¦ which is better, but thereā€™s a noticable transition as the sidebar height adjusts between statesā€¦ this is becuase .docked is either on or off.

If you want a sticky header, this is a little easier to work aroundā€¦ because you can increase --header-offset by the height of the custom header, and then set .d-header-wrapā€™s top value as the height of the custom header:

One solution that comes to mind for improving the case of the non-sticky header is to:

  1. Check the height of the custom header
  2. Include the custom header height in --header-offset
  3. De-increment the custom header height used in the --header-offset calculation based on scroll position. This will more gradually adjust the sidebar height in a way that the .docked class can not.

Might take some experimentation to get it rightā€¦

5 Likes

Thatā€™s very helpful, thank you @awesomerobot

(moved this to ux)

4 Likes

This has been implemented here (big thanks to @david):

This should solve sidebar, chat and some other issues with custom header content.

3 Likes