mirror of
https://github.com/searxng/searxng.git
synced 2024-11-13 13:41:03 +00:00
[fix] simple template: macro checkbox_onoff_reversed
In its previous implementation, the macro ``checkbox_onoff_reversed`` always created an ``aria-labelledby`` attribute, even if there was no descriptive tag with the generated ID (used as the value of the ``aria-labelledby``). Before this patch, the Nu-HTML-Checker [1] reported 255 issues of this type:: The aria-labelledby attribute must point to an element in the same document. (255) [1] https://validator.w3.org/nu/ Signed-off-by: Markus <markus@venom.fritz.box>
This commit is contained in:
parent
8b8d830fd3
commit
5ad0214bd4
2 changed files with 6 additions and 6 deletions
|
@ -27,11 +27,11 @@
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{%- macro checkbox_onoff_reversed(name, checked) -%}
|
{%- macro checkbox_onoff_reversed(name, checked, labelledby) -%}
|
||||||
<input type="checkbox" {{- ' ' -}}
|
<input type="checkbox" {{- ' ' -}}
|
||||||
name="{{ name }}" {{- ' ' -}}
|
name="{{ name }}" {{- ' ' -}}
|
||||||
id="{{ name }}" {{- ' ' -}}
|
id="{{ name }}" {{- ' ' -}}
|
||||||
aria-labelledby="pref_{{ name }}"{{- ' ' -}}
|
{%- if labelledby -%} aria-labelledby="{{ labelledby }}"{{- ' ' -}}{%- endif -%}
|
||||||
class="checkbox-onoff reversed-checkbox"{{- ' ' -}}
|
class="checkbox-onoff reversed-checkbox"{{- ' ' -}}
|
||||||
{%- if checked -%} checked{%- endif -%}>
|
{%- if checked -%} checked{%- endif -%}>
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
@ -42,9 +42,9 @@
|
||||||
<fieldset>{{- '' -}}
|
<fieldset>{{- '' -}}
|
||||||
<legend>{{ _(plugin.name) }}</legend>{{- '' -}}
|
<legend>{{ _(plugin.name) }}</legend>{{- '' -}}
|
||||||
<div class="value">
|
<div class="value">
|
||||||
{{- checkbox_onoff_reversed('plugin_' + plugin.id, plugin.id not in allowed_plugins) -}}
|
{{- checkbox_onoff_reversed('plugin_' + plugin.id, plugin.id not in allowed_plugins, 'plugin_labelledby' + plugin.id) -}}
|
||||||
</div>{{- '' -}}
|
</div>{{- '' -}}
|
||||||
<div class="description">
|
<div class="description" id="{{ 'plugin_labelledby' + plugin.id }}">
|
||||||
{{- _(plugin.description) -}}
|
{{- _(plugin.description) -}}
|
||||||
</div>{{- '' -}}
|
</div>{{- '' -}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -33,10 +33,10 @@
|
||||||
{%- for plugin in plugins -%}
|
{%- for plugin in plugins -%}
|
||||||
{%- if plugin.preference_section == 'query' -%}
|
{%- if plugin.preference_section == 'query' -%}
|
||||||
<tr>{{- '' -}}
|
<tr>{{- '' -}}
|
||||||
<td class="checkbox-col">{{- checkbox_onoff_reversed('plugin_' + plugin.id, plugin.id not in allowed_plugins) -}}</td>{{- '' -}}
|
<td class="checkbox-col">{{- checkbox_onoff_reversed('plugin_' + plugin.id, plugin.id not in allowed_plugins, 'plugin_labelledby' + plugin.id) -}}</td>{{- '' -}}
|
||||||
<td>{{ plugin.query_keywords|join(', ') }}</td>{{- '' -}}
|
<td>{{ plugin.query_keywords|join(', ') }}</td>{{- '' -}}
|
||||||
<td>{{ _(plugin.name) }}</td>{{- '' -}}
|
<td>{{ _(plugin.name) }}</td>{{- '' -}}
|
||||||
<td>{{ _(plugin.description) }}</td>{{- '' -}}
|
<td id="{{ 'plugin_labelledby' + plugin.id }}">{{ _(plugin.description) }}</td>{{- '' -}}
|
||||||
<td>{{ plugin.query_examples }}</td>{{- '' -}}
|
<td>{{ plugin.query_examples }}</td>{{- '' -}}
|
||||||
</tr>
|
</tr>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
Loading…
Reference in a new issue