Show a task card's actions above tabs for notes, images and materials

The opened task card keeps its details and description at the top, then
the status, book hours, edit and remove actions, and below them tabs:
checklist and comments, images, and materials and machines. The tabs are
a project component (x-tabs) after the WAI-ARIA pattern, because
TallStackUI's tab ties its panels to missing ids and has no arrow keys.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-29 09:58:04 +02:00
co-authored by Claude Sonnet 5.5
parent 701f05780f
commit 87e38260dc
10 changed files with 173 additions and 11 deletions
+37
View File
@@ -216,6 +216,42 @@ it('changes a task status and removes a task with the keyboard', function () {
->assertScript('document.activeElement.id', 'tasks-heading');
});
it('puts the task actions above the tabs and moves between the tabs with the arrow keys', function (string $device, string $colorScheme) {
$this->job->update(['status' => 'order']);
$workType = WorkTypeModel::query()->where('name', 'videokuvaus')->sole();
$task = TaskModel::factory()
->create(['customer_job_id' => $this->job->id, 'work_type_id' => $workType->id, 'title' => 'Kuvauspäivä']);
$tabs = 'task-'.$task->id.'-tabs';
$visit = visit(route('jobs.show', $this->job->id));
$visit = $device === 'mobile' ? $visit->on()->mobile() : $visit->on()->desktop();
$visit = $colorScheme === 'dark' ? $visit->inDarkMode() : $visit->inLightMode();
$visit->click('#task-toggle-'.$task->id)
->assertScript("!! (document.getElementById('task-status-{$task->id}').compareDocumentPosition(document.getElementById('{$tabs}-tab-notes')) & Node.DOCUMENT_POSITION_FOLLOWING)", true)
->assertAttribute('#'.$tabs.'-tab-notes', 'aria-selected', 'true')
->assertVisible('#checklist-new-'.$task->id)
->assertMissing('#'.$tabs.'-panel-images')
->keys('#'.$tabs.'-tab-notes', 'ArrowRight')
->assertScript('document.activeElement.id', $tabs.'-tab-images')
->assertAttribute('#'.$tabs.'-tab-images', 'aria-selected', 'true')
->assertAttribute('#'.$tabs.'-tab-notes', 'tabindex', '-1')
->assertVisible('#'.$tabs.'-panel-images')
->assertMissing('#'.$tabs.'-panel-notes')
->keys('#'.$tabs.'-tab-images', 'End')
->assertScript('document.activeElement.id', $tabs.'-tab-materials')
->assertSee('Tällä tehtävällä ei ole materiaaleja eikä koneita.')
->keys('#'.$tabs.'-tab-materials', 'ArrowRight')
->assertScript('document.activeElement.id', $tabs.'-tab-notes')
->assertNoJavaScriptErrors()
->assertNoAccessibilityIssues(level: 2);
})->with([
'desktop, light' => ['desktop', 'light'],
'desktop, dark' => ['desktop', 'dark'],
'mobile, light' => ['mobile', 'light'],
'mobile, dark' => ['mobile', 'dark'],
]);
it('shows task cards collapsed, opens several at once and expands or collapses them all', function () {
$this->job->update(['status' => 'order']);
$workType = WorkTypeModel::query()->where('name', 'videokuvaus')->sole();
@@ -348,6 +384,7 @@ it('recaptions and removes a task image with the keyboard', function () {
$page = visit(route('jobs.show', $this->job->id))
->click('#task-toggle-'.$task->id)
->click('#task-'.$task->id.'-tabs-tab-images')
->assertVisible('img[alt="Valot paikallaan"]')
->assertScript("document.querySelector('img[alt=\"Valot paikallaan\"]').naturalWidth > 0", true)
->assertSeeIn('#task-'.$task->id.'-title + dl', 'Kuvat:');