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
+66
View File
@@ -0,0 +1,66 @@
{{--
Tabs after the WAI-ARIA tabs pattern, because TallStackUI's <x-tab> ties its
panels to ids that do not exist and has no arrow keys. Only the selected tab
is in the tab order; arrow keys, Home and End move between the tabs and
select them. Panels are <x-tabs.panel> children with the same id.
$tabs: ['key' => 'title', ...] in display order.
--}}
@props([
'id',
'label',
'tabs',
'selected' => null,
])
@php
$selected ??= array_key_first($tabs);
@endphp
<div
{{ $attributes->class('space-y-3') }}
x-data="{
selected: @js($selected),
select(key) {
this.selected = key;
this.$nextTick(() => document.getElementById(@js($id) + '-tab-' + key)?.focus());
},
move(event) {
const keys = @js(array_keys($tabs));
const index = keys.indexOf(this.selected);
const next = { ArrowRight: index + 1, ArrowLeft: index - 1, Home: 0, End: keys.length - 1 }[event.key];
if (next === undefined) {
return;
}
event.preventDefault();
this.select(keys[(next + keys.length) % keys.length]);
},
}"
>
<div
role="tablist"
aria-label="{{ $label }}"
x-on:keydown="move($event)"
class="flex flex-wrap gap-x-4 gap-y-1 border-b border-zinc-200 dark:border-zinc-700"
>
@foreach ($tabs as $key => $title)
<button
type="button"
role="tab"
id="{{ $id }}-tab-{{ $key }}"
aria-controls="{{ $id }}-panel-{{ $key }}"
aria-selected="{{ $key === $selected ? 'true' : 'false' }}"
tabindex="{{ $key === $selected ? '0' : '-1' }}"
x-bind:aria-selected="(selected === @js($key)).toString()"
x-bind:tabindex="selected === @js($key) ? 0 : -1"
x-on:click="select(@js($key))"
x-bind:class="selected === @js($key)
? 'border-primary-700 font-semibold text-zinc-900 dark:border-primary-400 dark:text-white'
: 'border-transparent text-zinc-700 hover:border-zinc-400 dark:text-zinc-300'"
class="-mb-px min-h-6 rounded-t-md border-b-2 px-1 py-2 text-left text-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-700 dark:focus-visible:outline-blue-400"
>{{ $title }}</button>
@endforeach
</div>
{{ $slot }}
</div>
@@ -0,0 +1,21 @@
{{--
One panel of <x-tabs>: $tabsId is the id given to <x-tabs>, $name the key of
its tab. The panel is always rendered and only hidden, so Livewire components
in it keep their state.
--}}
@props([
'tabsId',
'name',
])
<div
{{ $attributes->class('rounded-md focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-700 dark:focus-visible:outline-blue-400') }}
role="tabpanel"
id="{{ $tabsId }}-panel-{{ $name }}"
aria-labelledby="{{ $tabsId }}-tab-{{ $name }}"
tabindex="0"
x-show="selected === @js($name)"
x-cloak
>
{{ $slot }}
</div>