From 5ad0214bd42f6615fd0b171a96519ba55d826315 Mon Sep 17 00:00:00 2001 From: Markus Date: Sun, 15 Sep 2024 17:14:52 +0200 Subject: [PATCH] [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 --- searx/templates/simple/preferences.html | 8 ++++---- searx/templates/simple/preferences/answerers.html | 4 ++-- 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) -%} {%- endmacro -%} @@ -42,9 +42,9 @@
{{- '' -}} {{ _(plugin.name) }}{{- '' -}}
- {{- 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) -}}
{{- '' -}} -
+
{{- _(plugin.description) -}}
{{- '' -}}
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' -%} {{- '' -}} - {{- 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) -}}{{- '' -}} {{ plugin.query_keywords|join(', ') }}{{- '' -}} {{ _(plugin.name) }}{{- '' -}} - {{ _(plugin.description) }}{{- '' -}} + {{ _(plugin.description) }}{{- '' -}} {{ plugin.query_examples }}{{- '' -}} {%- endif -%}