mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
We use `position: sticky;` on the header so that themes can introduce content above the header and have it behave properly. However, `position: sticky;` means that the header overscrolls with the rest of the page content, which is not ideal. Using `position: fixed` means that the header will not 'overscroll' when scrolling to the top of the page, which is a much better feeling UX. To keep support for content above the header, this PR automatically switches the header position strategy based on whether it's at the top of the page or not. If there is no content above, it'll be `position: fixed;`. If there is content, it'll keep the existing `position: sticky;` behavior.