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 <[email protected]>
This commit is contained in:
2026-11-30 11:13:38 +02:00
co-authored by Claude Opus 5.5
parent f3d2b3e39e
commit e274a8d2b1
2 changed files with 21 additions and 3 deletions
@@ -22,9 +22,10 @@
wire:ignore.self wire:ignore.self
x-data="{ get isLocked() { return {{ $locked }}; } }" x-data="{ get isLocked() { return {{ $locked }}; } }"
x-on:cancel="if (isLocked) { $event.preventDefault(); }" 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]) }}
> >
<div class="flex max-h-[92vh] flex-col"> {{-- Only the body scrolls: the dialog itself never does (one scrollbar), and its border takes 2px. --}}
<div class="flex max-h-[calc(100dvh-2rem-2px)] flex-col">
@isset($header) @isset($header)
{{ $header }} {{ $header }}
@else @else
@@ -42,7 +43,7 @@
</div> </div>
@endisset @endisset
<div class="flex-1 overflow-y-auto"> <div class="min-h-0 flex-1 overflow-y-auto">
{{ $slot }} {{ $slot }}
</div> </div>
+17
View File
@@ -176,6 +176,23 @@ it('has no accessibility issues in the job editor and the quick intake dialog',
'mobile, dark' => ['mobile', 'dark'], '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 () { it('marks a task done from the task panel of a card', function () {
$this->job->update(['status' => 'in_production']); $this->job->update(['status' => 'in_production']);
$task = TaskModel::factory()->create(['customer_job_id' => $this->job->id, 'title' => 'Leikkaus', 'status' => 'in_progress']); $task = TaskModel::factory()->create(['customer_job_id' => $this->job->id, 'title' => 'Leikkaus', 'status' => 'in_progress']);