From fc9417f7529c4c402fc08d2406e3ac63cff4617a Mon Sep 17 00:00:00 2001 From: Sluijsens Date: Tue, 17 Nov 2026 15:27:18 +0100 Subject: [PATCH] Hero: opslaanbalk echt tegen de onderrand van het scherm (sticky meet vanaf de contentrand), meer ruimte rond Opslaan Co-Authored-By: Claude Sonnet 5.5 --- .../src/features/hero/pages/HeroPage.test.tsx | 15 +++++++++++++++ frontend/src/features/hero/pages/HeroPage.tsx | 18 +++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/frontend/src/features/hero/pages/HeroPage.test.tsx b/frontend/src/features/hero/pages/HeroPage.test.tsx index 710f339..645f0d8 100644 --- a/frontend/src/features/hero/pages/HeroPage.test.tsx +++ b/frontend/src/features/hero/pages/HeroPage.test.tsx @@ -1170,4 +1170,19 @@ describe('Tabs Content and Images', () => { expect(bar).toHaveClass('-mx-6', 'bg-background', 'border-t'); expect(bar.className).not.toMatch(/bg-background\//); }); + + it('sticks flush with the bottom of the viewport: undoes the padding of the scrolling area, no bottom margin, and the page cancels the padding below it', async () => { + await openPage(); + + const bar = screen.getByTestId('hero-save-bar'); + //
has p-6 and a sticky box measures from the content edge, so -bottom-6 (measured in Chrome) puts it on the screen edge. + expect(bar).toHaveClass('sticky', '-bottom-6'); + expect(bar.className).not.toMatch(/(^|\s)-?mb-/); + expect(bar.className).not.toMatch(/(^|\s)(translate|bottom-)/); + expect(screen.getByTestId('hero-page')).toHaveClass('-mb-6'); + // Room around the button: more padding above and below than before. + expect(bar).toHaveClass('pt-4', 'gap-4'); + expect(bar.style.paddingBottom).toContain('1rem'); + expect(screen.getByTestId('hero-form').className).not.toMatch(/pb-/); + }); }); diff --git a/frontend/src/features/hero/pages/HeroPage.tsx b/frontend/src/features/hero/pages/HeroPage.tsx index b81943a..285f4b9 100644 --- a/frontend/src/features/hero/pages/HeroPage.tsx +++ b/frontend/src/features/hero/pages/HeroPage.tsx @@ -99,7 +99,7 @@ export function HeroPage() { const { data: hero, isLoading, isError, refetch } = useHero(); return ( -
+

{t('hero.title')}

{hero && ( @@ -386,7 +386,7 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) { const heroErrors = errors; return ( -
void handleSubmit(onSubmit, onInvalid)(event)} className="space-y-8 pb-4" noValidate data-testid="hero-form"> + void handleSubmit(onSubmit, onInvalid)(event)} className="space-y-8" noValidate data-testid="hero-form"> images[f.imageId]).filter((image): image is HeroImageDto => image !== undefined)} /> setServerError(null)} /> @@ -585,11 +585,15 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) {
- {/* Full width of the content area (no gap at the sides or below), opaque, with a clear top edge and a shadow; the - bottom padding keeps clear of the home bar of a phone. */} + {/* Flush with the bottom of the viewport and the full width of the content area, fully opaque so nothing shows + through or below it, with a clear top edge and a shadow. A sticky box measures its offset from the CONTENT + edge of the scrolling area (
has p-6), so "bottom: 0" would stop 24px above the screen edge and let + content show below the bar (measured in Chrome); -bottom-6 undoes that padding. The page root cancels the same + padding (-mb-6), so at the end of the page the bar is still at the very bottom and the last content is never + hidden behind it. The bottom padding clears the home bar of a phone. */}
@@ -605,7 +609,7 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) { disabled={save.isPending || !hasUnsaved} aria-disabled={save.isPending || !hasUnsaved} aria-busy={save.isPending} - className={hasUnsaved && !save.isPending ? 'ring-2 ring-primary ring-offset-2' : undefined} + className={`min-w-28 ${hasUnsaved && !save.isPending ? 'ring-2 ring-primary ring-offset-2' : ''}`} data-testid="hero-save" > {save.isPending ? (