Header shifts to the right when you open image gallery


When you want to see a big image in full screen, header is shifted by a few pixels to the right of the screen.

Edit: I’m on Chrome.


This occurs because we hide the browser scrollbar when you open a lightbox.

Given that the scrollbar width is different on different browsers on different platforms, it makes sense to leave this as is for now since the visual inconsistency is not very noticeable unless you’re looking directly at it.


Yes, that’s what I suspected. But why the rest of the content is not affected by this?


Well, that’s a good question.

The answer is because Magnific-popup - the dependency the handles galleries in Discourse - actually does what I described above. It checks the width of the scrollbar in the current browser and then compensates with inline margins.




This works well for the content of the page, but the fact that the header in Discourse is positioned with CSS - absolute and then fixed when you scroll down - means that things don’t come out right for it. So, you get the issue you described.

So, the options are:

1- manually compensate with CSS
this doesn’t work because of different scrollbar widths.

2- maintain a fork of Magnific-popup that fixes this
this is out of the question.

3- duplicate the scrollbar width calculation in Discourse
this is way too much code for a simple visual inconsistency.

4- leave this as is because how involved a fix would be V.S the benefits of adding it.

I still think #4 is the way to go here, at least for now.


Ok, thank you for the explanations. :slightly_smiling_face: