Skip to content

A free open source IT asset/license management system

Added form help text component

snipeaadbbf13254e
diff --git a/resources/views/blade/form/checkbox-row.blade.php b/resources/views/blade/form/checkbox-row.blade.php
index 0f9b49da2d..7bc5729027 100644
--- a/resources/views/blade/form/checkbox-row.blade.php
+++ b/resources/views/blade/form/checkbox-row.blade.php
@@ -87,6 +87,7 @@
:required="$really_required"
:disabled="$disabled"
:aria-label="$name"
+ :aria-describedby="$help_text ? $name.'-help' : null"
/>
{{ $label }}
</label>
@@ -108,6 +109,7 @@
:checked="$is_checked($option_value)"
:disabled="$disabled"
:aria-label="$name"
+ :aria-describedby="$help_text ? $name.'-help' : null"
/>
{{ $option_label }}
</label>
@@ -132,9 +134,7 @@
@if ($help_text)
<div class="col-md-8 col-md-offset-3">
- <p class="help-block">
- {!! $help_text !!}
- </p>
+ <x-form.help :name="$name">{!! $help_text !!}</x-form.help>
</div>
@endif
diff --git a/resources/views/blade/form/help.blade.php b/resources/views/blade/form/help.blade.php
new file mode 100644
index 0000000000..4fcb90942c
--- /dev/null
+++ b/resources/views/blade/form/help.blade.php
@@ -0,0 +1,7 @@
+@props(['name', 'icon' => null])
+<p class="help-block" id="{{ $name }}-help">
+ @if ($icon)
+ <x-icon :type="$icon" />
+ @endif
+ {{ $slot }}
+</p>
diff --git a/resources/views/blade/form/radio-row.blade.php b/resources/views/blade/form/radio-row.blade.php
index fdfc215fd7..c6229764b9 100644
--- a/resources/views/blade/form/radio-row.blade.php
+++ b/resources/views/blade/form/radio-row.blade.php
@@ -53,6 +53,7 @@
:required="$really_required && $loop->first"
:disabled="$disabled"
:aria-label="$name"
+ :aria-describedby="$help_text ? $name.'-help' : null"
/>
{{ $option_label }}
</label>
@@ -75,9 +76,7 @@
@if ($help_text)
<div class="col-md-8 col-md-offset-3">
- <p class="help-block">
- {!! $help_text !!}
- </p>
+ <x-form.help :name="$name">{!! $help_text !!}</x-form.help>
</div>
@endif
diff --git a/resources/views/blade/form/row.blade.php b/resources/views/blade/form/row.blade.php
index 0f8d3be1ea..0187f225cb 100644
--- a/resources/views/blade/form/row.blade.php
+++ b/resources/views/blade/form/row.blade.php
@@ -31,6 +31,7 @@
:$name
:$type
:aria-label="$name"
+ :aria-describedby="$help_text ? $name.'-help' : null"
:component="'input.'.$blade_type"
:id="$name"
:required="Helper::checkIfRequired($item, $name)"
@@ -60,9 +61,7 @@
@if ($help_text)
<!-- Help Text -->
<div class="col-md-8 col-md-offset-3">
- <p class="help-block">
- {!! $help_text !!}
- </p>
+ <x-form.help :name="$name">{!! $help_text !!}</x-form.help>
</div>
@endif
diff --git a/resources/views/blade/input/quantity.blade.php b/resources/views/blade/input/quantity.blade.php
index ca8f45dd49..2daa343ba2 100644
--- a/resources/views/blade/input/quantity.blade.php
+++ b/resources/views/blade/input/quantity.blade.php
@@ -27,6 +27,7 @@
name="{{ $name }}"
id="{{ $name }}"
aria-label="{{ $label ?? trans('general.quantity') }}"
+ @if ($help_text) aria-describedby="{{ $name }}-help" @endif
value="{{ old($name, $value ?? $item?->{$name} ?? '') }}"
min="{{ $min }}"
@if ($max) max="{{ $max }}" @endif
@@ -37,7 +38,7 @@
<div class="col-md-12" style="padding-left: 0">
<x-form.error :name="$name" />
@if ($help_text)
- <p class="help-block">{{ $help_text }}</p>
+ <x-form.help :name="$name">{{ $help_text }}</x-form.help>
@endif
</div>
</div>