Add browser accessibility tests for the reports
Fixes found by axe: the chart axis captions are darker and larger, the period heading keeps its heading role with the live region inside it, and scrollable tables are focusable regions named by their table. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -97,14 +97,14 @@ new class extends Component
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h2 class="text-xl font-semibold" role="status" aria-live="polite">{{ $this->periodLabel() }}</h2>
|
||||
<h2 class="text-xl font-semibold"><span role="status" aria-live="polite">{{ $this->periodLabel() }}</span></h2>
|
||||
<x-button :href="$this->csv()" subtle color="black" icon="arrow-down-tray" :text="__('reports.download_csv')" />
|
||||
</div>
|
||||
|
||||
@if ($report->people === [])
|
||||
<p>{{ __('reports.hours.none') }}</p>
|
||||
@else
|
||||
<div class="overflow-x-auto">
|
||||
<div class="overflow-x-auto rounded focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600" tabindex="0" role="region" aria-label="{{ __('reports.hours.table', ['period' => $this->periodLabel()]) }}">
|
||||
<table class="w-full text-sm">
|
||||
<caption class="sr-only">{{ __('reports.hours.table', ['period' => $this->periodLabel()]) }}</caption>
|
||||
<thead>
|
||||
|
||||
@@ -87,7 +87,7 @@ new class extends Component
|
||||
|
||||
@if ($report !== null)
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h2 class="text-xl font-semibold" role="status" aria-live="polite">{{ $this->periodLabel() }}</h2>
|
||||
<h2 class="text-xl font-semibold"><span role="status" aria-live="polite">{{ $this->periodLabel() }}</span></h2>
|
||||
<x-button :href="$this->csvUrl('profitability', ['sisaiset' => $includeInternal ? '1' : ''])" subtle color="black" icon="arrow-down-tray" :text="__('reports.download_csv')" />
|
||||
</div>
|
||||
|
||||
@@ -112,7 +112,7 @@ new class extends Component
|
||||
<h2 id="units-heading" class="text-xl font-semibold">{{ __('reports.profitability.by_service_unit') }}</h2>
|
||||
<p class="text-sm">{{ __('reports.profitability.split_note') }}</p>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<div class="overflow-x-auto rounded focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600" tabindex="0" role="region" aria-label="{{ __('reports.profitability.units_table', ['period' => $this->periodLabel()]) }}">
|
||||
<table class="w-full text-sm">
|
||||
<caption class="sr-only">{{ __('reports.profitability.units_table', ['period' => $this->periodLabel()]) }}</caption>
|
||||
<thead>
|
||||
@@ -156,7 +156,7 @@ new class extends Component
|
||||
<section aria-labelledby="jobs-heading" class="space-y-4">
|
||||
<h2 id="jobs-heading" class="text-xl font-semibold">{{ __('reports.profitability.by_job') }}</h2>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<div class="overflow-x-auto rounded focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600" tabindex="0" role="region" aria-label="{{ __('reports.profitability.jobs_table', ['period' => $this->periodLabel()]) }}">
|
||||
<table class="w-full text-sm">
|
||||
<caption class="sr-only">{{ __('reports.profitability.jobs_table', ['period' => $this->periodLabel()]) }}</caption>
|
||||
<thead>
|
||||
|
||||
@@ -66,7 +66,7 @@ new class extends Component
|
||||
|
||||
@if ($report !== null)
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h2 class="text-xl font-semibold" role="status" aria-live="polite">{{ $this->periodLabel() }}</h2>
|
||||
<h2 class="text-xl font-semibold"><span role="status" aria-live="polite">{{ $this->periodLabel() }}</span></h2>
|
||||
<div class="flex flex-wrap gap-2 print:hidden">
|
||||
<x-button x-on:click="window.print()" subtle color="black" icon="printer" :text="__('reports.reimbursements.print')" />
|
||||
<x-button :href="$this->csvUrl('reimbursements')" subtle color="black" icon="arrow-down-tray" :text="__('reports.download_csv')" />
|
||||
@@ -84,7 +84,7 @@ new class extends Component
|
||||
<section wire:key="person-{{ $person->userId }}" aria-labelledby="person-{{ $person->userId }}" class="space-y-2 break-inside-avoid">
|
||||
<h3 id="person-{{ $person->userId }}" class="text-lg font-semibold">{{ $person->name }}</h3>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<div class="overflow-x-auto rounded focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600" tabindex="0" role="region" aria-label="{{ __('reports.reimbursements.table', ['name' => $person->name, 'period' => $this->periodLabel()]) }}">
|
||||
<table class="w-full text-sm">
|
||||
<caption class="sr-only">{{ __('reports.reimbursements.table', ['name' => $person->name, 'period' => $this->periodLabel()]) }}</caption>
|
||||
<thead>
|
||||
|
||||
@@ -63,7 +63,7 @@ new class extends Component
|
||||
|
||||
@if ($report !== null)
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h2 class="text-xl font-semibold" role="status" aria-live="polite">{{ $this->periodLabel() }}</h2>
|
||||
<h2 class="text-xl font-semibold"><span role="status" aria-live="polite">{{ $this->periodLabel() }}</span></h2>
|
||||
<x-button :href="$this->csvUrl('sales')" subtle color="black" icon="arrow-down-tray" :text="__('reports.download_csv')" />
|
||||
</div>
|
||||
|
||||
@@ -179,7 +179,7 @@ new class extends Component
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<div class="overflow-x-auto rounded focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600" tabindex="0" role="region" aria-label="{{ __('reports.sales.by_day') }}">
|
||||
<table class="w-full text-sm">
|
||||
<caption class="mb-2 text-left text-base font-semibold">{{ __('reports.sales.by_day') }}</caption>
|
||||
<thead>
|
||||
|
||||
@@ -112,14 +112,14 @@ new class extends Component
|
||||
</p>
|
||||
@else
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h2 class="text-xl font-semibold" role="status" aria-live="polite">{{ __('reports.unbilled.until', ['day' => $this->dateLabel($day)]) }}</h2>
|
||||
<h2 class="text-xl font-semibold"><span role="status" aria-live="polite">{{ __('reports.unbilled.until', ['day' => $this->dateLabel($day)]) }}</span></h2>
|
||||
<x-button :href="$this->csv()" subtle color="black" icon="arrow-down-tray" :text="__('reports.download_csv')" />
|
||||
</div>
|
||||
|
||||
@if ($report->jobs === [])
|
||||
<p>{{ __('reports.unbilled.none') }}</p>
|
||||
@else
|
||||
<div class="overflow-x-auto">
|
||||
<div class="overflow-x-auto rounded focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600" tabindex="0" role="region" aria-label="{{ __('reports.unbilled.table', ['day' => $this->dateLabel($day)]) }}">
|
||||
<table class="w-full text-sm">
|
||||
<caption class="sr-only">{{ __('reports.unbilled.table', ['day' => $this->dateLabel($day)]) }}</caption>
|
||||
<thead>
|
||||
|
||||
@@ -69,5 +69,12 @@ class AppServiceProvider extends ServiceProvider
|
||||
->select('native')
|
||||
->block('error')
|
||||
->replace('text-red-600!', 'text-red-700! dark:!text-red-400');
|
||||
|
||||
// Chart axis captions are gray-500 at 10 px, 4.4:1 on the page background.
|
||||
foreach (['axis.y.label', 'axis.y.right.label', 'axis.x.label'] as $block) {
|
||||
TallStackUi::customize('chart')
|
||||
->block($block)
|
||||
->replace(['text-gray-500' => 'text-gray-700', 'dark:text-dark-400' => 'dark:text-dark-200', 'text-[0.65rem]' => 'text-xs']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user