ui: a Back button is a row of one, not a stretched flex child

Reported: the Back button fills the page width on the domain and channel edit
pages.  It fills it on all nine pages that have one, and this is mine from the
last PR.

`.wrolpi-stack` is a flex column at `align-items: stretch`, deliberately -- a
panel was full-width as a block element and has to stay that way.  A BARE button
as a direct child of that stack is stretched too, and every page's Back button
was one.  On the domain, channel and playlist edit pages it also pushed the
button beside it onto its own line, where the two had been inline.

Wrapping each in a `.wrolpi-button-row` fixes both without touching the stack:
the row is the stretched child, and it lays its buttons out at their own width.
The three pages that have a second button get one row holding both, which is how
they read before.

Also the Videos, Archives and Documents select bars, whose Tag/Delete/Invert/
Clear were four touching buttons in a bare div.  They are inline elements rather
than interpolations, which is the shape the bare-siblings scan does not see.

Guarded twice: the row keeps its buttons their own width inside a stack while
itself stretching (both halves, since a row that refused to stretch would pass a
test that only looked at the button), and every `<BackButton/>` in the app is
inside a row.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-05 16:47:33 -06:00
parent 7741ee1f12
commit 076e982b69
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
8 changed files with 88 additions and 21 deletions

View file

@ -390,6 +390,32 @@ describe('a row of buttons is spaced and aligned by the row', () => {
});
});
it('keeps its buttons their own width inside a page stack', () => {
/*
* `.wrolpi-stack` is a flex column at `align-items: stretch`, which is what keeps a panel
* full-width as it was as a block element -- and which stretched every page's Back button
* to the full width of the page, because a bare button was a direct child of it.
*
* The row is what absorbs that: the ROW is the stretched child, and it lays its buttons out
* at their own width. Both halves are asserted, because a row that also refused to stretch
* would pass a test that only looked at the button.
*/
cy.mountUI(<div className='wrolpi-stack'>
<div className='wrolpi-button-row'><Button>Back</Button></div>
<Panel>The page</Panel>
</div>);
cy.get('.wrolpi-stack').should(($stack) => {
const stack = $stack[0].getBoundingClientRect();
const row = $stack[0].querySelector('.wrolpi-button-row').getBoundingClientRect();
const button = $stack[0].querySelector('button').getBoundingClientRect();
expect(stack.width, 'the stack has a width to fill').to.be.greaterThan(200);
expect(row.width, 'the row stretches, as the panel does').to.be.closeTo(stack.width, 0.5);
expect(button.width, 'the button does not').to.be.lessThan(stack.width / 2);
});
});
it('grows its gap with the interface scale', () => {
cy.mountUI(<div className='wrolpi-button-row'><Button>One</Button><Button>Two</Button></div>);