tl;dr I think that Page.fillColumn should skip fallback for figure that have already been placed when looking for the next block.
Consider an article like this:
<h1 class="keepwithnext">Section Title</h1>
<div data-sizes="double"><img src="image1"></div>
And a very simple grid with a container for the double plus two columns.
As long as the height is sufficient to fit everything, this works nicely; this example is too simple to show it off, but .keepwithnext really works nicely with figure fallback content, too.
As you make the browser windows shorter, this breaks down and you end up with the "Section Title" in one column and "Text 1/Text 2" in the second one.
This happens because of an inconsistency in Page.fillColumn:
[#290] When looking for the next block for keepwithnext we need to ex…
…clude fallback content for figures that have already been placed.
See https://github.com/andreacampi/treesaver/tree/issue-290 for my attempt at fixing this.
Existing tests pass; writing a specific test for this sounds like a daunting task though.
I'm not sure this is a complete fix. Page.nextNotUsedBlock probably needs to use getNextNonChildBlock instead of simply iterating on blocks?
[#290] When looking for the top margin of the next sibling we need to…
… skip fallbacks for figures that have already been used.