"packed" galleries are jumpy because browser menu bars sliding into view secretly resize the browser viewport, and every time the browser viewport is resized we recalculate their dimensions.
In this example, I am testing on https://en.wikipedia.org/wiki/Middle_East#Gallery, I press Ctrl+F to open the search bar, and then close it. The gallery jumps back and forth both times. (This is on Opera, but Firefox and Edge do the same thing.)
(the file is too large for Phabricator…)
@Legoktm has had similar issues with mobile browsers when their address bar slides into view: