From e274a8d2b1f37b10498158898b93c3ef95e9952e Mon Sep 17 00:00:00 2001 From: Petri Saarinen Date: Mon, 30 Nov 2026 11:13:38 +0200 Subject: [PATCH] Scroll only the body of work dialogs, so there is one scrollbar The native dialog scrolled too once its content outgrew the browser's default max-height. It now clips to the viewport and only the body scrolls. Co-Authored-By: Claude Opus 5.5 --- .../views/components/work-dialog.blade.php | 7 ++++--- tests/Browser/JobsAccessibilityTest.php | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/resources/views/components/work-dialog.blade.php b/resources/views/components/work-dialog.blade.php index 06e6e42..68d2d06 100644 --- a/resources/views/components/work-dialog.blade.php +++ b/resources/views/components/work-dialog.blade.php @@ -22,9 +22,10 @@ wire:ignore.self x-data="{ get isLocked() { return {{ $locked }}; } }" x-on:cancel="if (isLocked) { $event.preventDefault(); }" - {{ $attributes->class(['m-auto w-[calc(100%-1rem)] rounded-2xl border border-neutral-300 bg-white p-0 text-neutral-900 shadow-2xl backdrop:bg-black/70 dark:border-[#3e4249] dark:bg-[#222427] dark:text-neutral-100', $width]) }} + {{ $attributes->class(['m-auto max-h-[calc(100dvh-2rem)] w-[calc(100%-1rem)] overflow-hidden rounded-2xl border border-neutral-300 bg-white p-0 text-neutral-900 shadow-2xl backdrop:bg-black/70 dark:border-[#3e4249] dark:bg-[#222427] dark:text-neutral-100', $width]) }} > -
+ {{-- Only the body scrolls: the dialog itself never does (one scrollbar), and its border takes 2px. --}} +
@isset($header) {{ $header }} @else @@ -42,7 +43,7 @@
@endisset -
+
{{ $slot }}
diff --git a/tests/Browser/JobsAccessibilityTest.php b/tests/Browser/JobsAccessibilityTest.php index 8a79200..17fe0bd 100644 --- a/tests/Browser/JobsAccessibilityTest.php +++ b/tests/Browser/JobsAccessibilityTest.php @@ -176,6 +176,23 @@ it('has no accessibility issues in the job editor and the quick intake dialog', 'mobile, dark' => ['mobile', 'dark'], ]); +it('scrolls only the body of the job editor when a task has many comments', function () { + $task = TaskModel::factory()->create(['customer_job_id' => $this->job->id, 'title' => 'Kuvauspäivä']); + + foreach (range(1, 15) as $number) { + TaskCommentModel::query()->create(['task_id' => $task->id, 'user_id' => $this->user->id, 'body' => 'Kommentti numero '.$number.' kuvauspäivän järjestelyistä.']); + } + + visit(route('jobs.board')) + ->on()->desktop() + ->click('#card-job-'.$this->job->id.'-open') + ->click('#job-editor-dialog [aria-controls^="editor-extras-"]') + ->assertSee('Kommentti numero 15') + ->assertScript('getComputedStyle(document.getElementById("job-editor-dialog")).overflowY', 'hidden') + ->assertScript('(() => { const d = document.getElementById("job-editor-dialog"); return d.scrollHeight <= d.clientHeight + 1; })()', true) + ->assertNoAccessibilityIssues(level: 2); +}); + it('marks a task done from the task panel of a card', function () { $this->job->update(['status' => 'in_production']); $task = TaskModel::factory()->create(['customer_job_id' => $this->job->id, 'title' => 'Leikkaus', 'status' => 'in_progress']);