Open only the info popover when a calendar bar is tapped

On touch screens a tap on a task bar both showed its info popover and
opened the schedule dialog. A tap now only opens the popover, which stays
open until something else is tapped, and the popover's own "Open schedule"
button opens the dialog. Mouse clicks and Enter still open the dialog
directly. The popover is no longer a tooltip since it holds a button, and
the bar's aria-describedby points only at the details.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-26 09:35:53 +02:00
co-authored by Claude Sonnet 5.5
parent 4bba130c4c
commit 3faa4cfbc6
6 changed files with 161 additions and 36 deletions
@@ -97,6 +97,30 @@ it('shows the job details of a bar on hover and focus, and closes them with Esca
->assertNoJavaScriptErrors();
})->with(['light', 'dark']);
it('opens only the popover on a tap, and the dialog from its button', function () {
$key = $this->task->id.'-'.$this->user->id;
$open = "document.getElementById('bar-info-{$key}').matches(':popover-open')";
$tap = <<<JS
(() => {
const bar = document.getElementById('bar-{$key}');
const options = { bubbles: true, pointerType: 'touch', isPrimary: true, button: 0 };
bar.dispatchEvent(new PointerEvent('pointerdown', options));
bar.dispatchEvent(new PointerEvent('pointerup', options));
bar.dispatchEvent(new MouseEvent('mouseenter'));
bar.click();
})()
JS;
$visit = visit(route('jobs.calendar'))->on()->desktop();
$visit->script($tap);
$visit->assertScript($open, true)
->assertScript("document.getElementById('task-schedule-dialog').open", false)
->click('#bar-info-'.$key.'-open')
->assertSee('Tehtävän aikataulu')
->assertScript("document.getElementById('task-schedule-dialog').open", true)
->assertScript($open, false);
});
it('moves a task to another person by dragging its bar', function () {
// The bar (today – today + 2) is grabbed at its middle day, so dropping it
// on today + 4 moves it three days later.
@@ -179,7 +179,8 @@ it('shows the job details in the info popover of a bar', function () {
$task = TaskModel::query()->sole();
Livewire::test('jobs::calendar')
->assertSee('aria-describedby="bar-info-'.$task->id.'-'.$this->other->id.'"', escape: false)
->assertSee('aria-describedby="bar-info-'.$task->id.'-'.$this->other->id.'-details"', escape: false)
->assertSee('Avaa aikataulu: tehtävä Mainoskuvat')
->assertSeeInOrder([
'Työ', $this->job->number, 'Kampanja',
'Asiakas', CustomerModel::query()->findOrFail($this->job->customer_id)->name,