sindresorhus / hide-files-on-github

Chrome extension - Hide nonessential files from the GitHub file browser
https://chrome.google.com/webstore/detail/hide-files-on-github/lpnakhpaodhdkleejaehlapdhbgjbddp
MIT License
320 stars 36 forks source link

Fix Firefox FOUC #94

Closed fregante closed 4 years ago

fregante commented 4 years ago

Fixes #93

For whatever reasons, the moment you call getBoundingClientRect or any offset* properties, we get that ugly FOUC. I'd been seeing this for a long time but never thought it could be an extension causing it.


In Firefox only, hide overflowing items and then, after a short wait (🤷‍♂️) run the calculations.

Test

https://github.com/babel/babel

fregante commented 4 years ago

I think I figured out why by the way: we inject the script at “document_start” and we’re forcing Firefox to give us the layout size before it’s done evaluating the style sheet.

Chrome I guess pauses our script until the style sheet is done but Firefox just does a layout, displays it and then updates it when the CSS is ready.