summaryrefslogtreecommitdiff
path: root/searx/templates
diff options
context:
space:
mode:
authorMarkus <markus@venom.fritz.box>2024-09-15 17:14:52 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-09-21 15:23:21 +0200
commit5ad0214bd42f6615fd0b171a96519ba55d826315 (patch)
treef8e55cd0cafb0dd34f59fa20aaa7d62786b8f837 /searx/templates
parent8b8d830fd367386c5f06ae5a427028dc12642cd1 (diff)
downloadsearxng-5ad0214bd42f6615fd0b171a96519ba55d826315.tar.gz
searxng-5ad0214bd42f6615fd0b171a96519ba55d826315.zip
[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>
Diffstat (limited to 'searx/templates')
-rw-r--r--searx/templates/simple/preferences.html8
-rw-r--r--searx/templates/simple/preferences/answerers.html4
2 files changed, 6 insertions, 6 deletions
diff --git a/searx/templates/simple/preferences.html b/searx/templates/simple/preferences.html
index 5b72d5f9e..c04d442f2 100644
--- a/searx/templates/simple/preferences.html
+++ b/searx/templates/simple/preferences.html
@@ -27,11 +27,11 @@
{%- endif -%}
{%- endmacro -%}
-{%- macro checkbox_onoff_reversed(name, checked) -%}
+{%- macro checkbox_onoff_reversed(name, checked, labelledby) -%}
<input type="checkbox" {{- ' ' -}}
name="{{ name }}" {{- ' ' -}}
id="{{ name }}" {{- ' ' -}}
- aria-labelledby="pref_{{ name }}"{{- ' ' -}}
+ {%- if labelledby -%} aria-labelledby="{{ labelledby }}"{{- ' ' -}}{%- endif -%}
class="checkbox-onoff reversed-checkbox"{{- ' ' -}}
{%- if checked -%} checked{%- endif -%}>
{%- endmacro -%}
@@ -42,9 +42,9 @@
<fieldset>{{- '' -}}
<legend>{{ _(plugin.name) }}</legend>{{- '' -}}
<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 class="description">
+ <div class="description" id="{{ 'plugin_labelledby' + plugin.id }}">
{{- _(plugin.description) -}}
</div>{{- '' -}}
</fieldset>
diff --git a/searx/templates/simple/preferences/answerers.html b/searx/templates/simple/preferences/answerers.html
index 98ae61830..983646ae9 100644
--- a/searx/templates/simple/preferences/answerers.html
+++ b/searx/templates/simple/preferences/answerers.html
@@ -33,10 +33,10 @@
{%- for plugin in plugins -%}
{%- if plugin.preference_section == 'query' -%}
<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.name) }}</td>{{- '' -}}
- <td>{{ _(plugin.description) }}</td>{{- '' -}}
+ <td id="{{ 'plugin_labelledby' + plugin.id }}">{{ _(plugin.description) }}</td>{{- '' -}}
<td>{{ plugin.query_examples }}</td>{{- '' -}}
</tr>
{%- endif -%}