Added focus and a11y attributes/functionality to custom checkboxes

Closes #1476
This commit is contained in:
Dan Brown
2019-06-04 10:45:44 +01:00
parent a602cdf401
commit a9f983f156
6 changed files with 51 additions and 8 deletions

View File

@ -3,9 +3,13 @@ $name
$value
$checked
$label
$tabindex
--}}
<label class="toggle-switch @if($errors->has($name)) text-neg @endif">
<label custom-checkbox class="toggle-switch @if($errors->has($name)) text-neg @endif">
<input type="checkbox" name="{{$name}}" value="{{ $value }}" @if($checked) checked="checked" @endif>
<span class="custom-checkbox text-primary">@icon('check')</span>
<span tabindex="{{ $tabindex ?? '0' }}"
role="checkbox"
aria-checked="{{ $checked ? 'true' : 'false' }}"
class="custom-checkbox text-primary">@icon('check')</span>
<span class="label">{{$label}}</span>
</label>

View File

@ -1,6 +1,9 @@
<label toggle-switch="{{$name}}" class="toggle-switch">
<label toggle-switch="{{$name}}" custom-checkbox class="toggle-switch">
<input type="hidden" name="{{$name}}" value="{{$value?'true':'false'}}"/>
<input type="checkbox" @if($value) checked="checked" @endif>
<span class="custom-checkbox text-primary">@icon('check')</span>
<span tabindex="{{ $tabindex ?? '0' }}"
role="checkbox"
aria-checked="{{ $value ? 'true' : 'false' }}"
class="custom-checkbox text-primary">@icon('check')</span>
<span class="label">{{ $label }}</span>
</label>