Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions resources/views/livewire/saved-views-control.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class="fi-checkbox-input"
@checked($view->submenu_visible)
wire:change="toggleSubmenu('{{ $view->id }}')"
title="{{ __('filament-saved-views::saved-views.submenu_visible') }}"
{{-- The title alone read the same in every row; name the view too. --}}
aria-label="{{ __('filament-saved-views::saved-views.submenu_visible') }}: {{ $view->label }}"
/>

<a
Expand All @@ -60,9 +62,12 @@ class="fi-checkbox-input"
{{ ($this->editViewAction)(['id' => $view->id]) }}
{{ ($this->deleteViewAction)(['id' => $view->id]) }}

{{-- Labelled like Filament's own drag handles: its translated "Move" plus
what moves (the column manager does "Reorder column" + the column name). --}}
<button
x-sortable-handle
x-on:click.stop
aria-label="{{ __('filament-forms::components.builder.actions.reorder.label') }} {{ $view->label }}"
class="fi-fm-sv-handle"
type="button"
>
Expand Down
24 changes: 24 additions & 0 deletions tests/Feature/AccessibleControlsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

$template = fn (): string => (string) file_get_contents(dirname(__DIR__, 2) . '/resources/views/livewire/saved-views-control.blade.php');

it('names the drag handle after the view it moves', function () use ($template): void {
// An icon-only button with no name is announced as just "button". Filament labels its own drag
// handles with its translated "Move" / "Reorder column" plus what moves; this does the same.
expect($template())->toContain('aria-label="{{ __(\'filament-forms::components.builder.actions.reorder.label\') }} {{ $view->label }}"');
});

it('names the sub-navigation checkbox after its view', function () use ($template): void {
// The title alone read the same in every row.
expect($template())->toContain('aria-label="{{ __(\'filament-saved-views::saved-views.submenu_visible\') }}: {{ $view->label }}"');
});

it('resolves the borrowed Filament label in every locale the package ships', function (): void {
foreach (glob(dirname(__DIR__, 2) . '/resources/lang/*', GLOB_ONLYDIR) ?: [] as $directory) {
$label = trans('filament-forms::components.builder.actions.reorder.label', [], basename($directory));

expect($label)->toBeString()->not->toBe('filament-forms::components.builder.actions.reorder.label');
}
});
Loading