From 67fcf3cc67c842aebd512922a751d0ebe1bb9264 Mon Sep 17 00:00:00 2001 From: Markus Date: Sun, 15 Sep 2024 17:05:02 +0200 Subject: [PATCH 1/9] [fix] Removes ``/>`` ending tags for void HTML elements continuation of commit: 0b832f19b Signed-off-by: Markus --- searx/templates/simple/preferences/center_alignment.html | 2 +- searx/templates/simple/preferences/image_proxy.html | 2 +- searx/templates/simple/preferences/infinite_scroll.html | 2 +- searx/templates/simple/preferences/query_in_title.html | 2 +- searx/templates/simple/preferences/results_on_new_tab.html | 2 +- .../templates/simple/preferences/search_on_category_select.html | 2 +- searx/templates/simple/preferences/tokens.html | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/searx/templates/simple/preferences/center_alignment.html b/searx/templates/simple/preferences/center_alignment.html index 80508a1ae..fa94da3ad 100644 --- a/searx/templates/simple/preferences/center_alignment.html +++ b/searx/templates/simple/preferences/center_alignment.html @@ -8,7 +8,7 @@ {%- if preferences.get_value('center_alignment') -%} checked {%- endif -%}{{- ' ' -}} - />{{- '' -}} + >{{- '' -}}

{{- '' -}}
{{- _('Displays results in the center of the page (Oscar layout).') -}} diff --git a/searx/templates/simple/preferences/image_proxy.html b/searx/templates/simple/preferences/image_proxy.html index afb3465d4..d79a57b16 100644 --- a/searx/templates/simple/preferences/image_proxy.html +++ b/searx/templates/simple/preferences/image_proxy.html @@ -8,7 +8,7 @@ {%- if preferences.get_value('image_proxy') -%} checked {%- endif -%}{{- ' ' -}} - />{{- '' -}} + >{{- '' -}}

{{- '' -}}
{{- _('Proxying image results through SearXNG') -}} diff --git a/searx/templates/simple/preferences/infinite_scroll.html b/searx/templates/simple/preferences/infinite_scroll.html index 1a734ae1a..cda8008c9 100644 --- a/searx/templates/simple/preferences/infinite_scroll.html +++ b/searx/templates/simple/preferences/infinite_scroll.html @@ -8,7 +8,7 @@ {%- if preferences.get_value('infinite_scroll') -%} checked {%- endif -%}{{- ' ' -}} - />{{- '' -}} + >{{- '' -}}

{{- '' -}}
{{- _('Automatically load next page when scrolling to bottom of current page') -}} diff --git a/searx/templates/simple/preferences/query_in_title.html b/searx/templates/simple/preferences/query_in_title.html index 924d6ccd1..468df901a 100644 --- a/searx/templates/simple/preferences/query_in_title.html +++ b/searx/templates/simple/preferences/query_in_title.html @@ -8,7 +8,7 @@ {%- if preferences.get_value('query_in_title') -%} checked {%- endif -%}{{- ' ' -}} - />{{- '' -}} + >{{- '' -}}

{{- '' -}}
{{- _("When enabled, the result page's title contains your query. Your browser can record this title") -}} diff --git a/searx/templates/simple/preferences/results_on_new_tab.html b/searx/templates/simple/preferences/results_on_new_tab.html index 972485dcf..2e05bca01 100644 --- a/searx/templates/simple/preferences/results_on_new_tab.html +++ b/searx/templates/simple/preferences/results_on_new_tab.html @@ -8,7 +8,7 @@ {%- if preferences.get_value('results_on_new_tab') -%} checked {%- endif -%}{{- ' ' -}} - />{{- ' ' -}} + >{{- ' ' -}}

{{- '' -}}
{{- _('Open result links on new browser tabs') -}} diff --git a/searx/templates/simple/preferences/search_on_category_select.html b/searx/templates/simple/preferences/search_on_category_select.html index 2bc680a61..76e970fa2 100644 --- a/searx/templates/simple/preferences/search_on_category_select.html +++ b/searx/templates/simple/preferences/search_on_category_select.html @@ -8,7 +8,7 @@ {%- if preferences.get_value('search_on_category_select') -%} checked {%- endif -%}{{- ' ' -}} - />{{- '' -}} + >{{- '' -}}

{{- '' -}}
{{- _('Perform search immediately if a category selected. Disable to select multiple categories') -}} diff --git a/searx/templates/simple/preferences/tokens.html b/searx/templates/simple/preferences/tokens.html index 11d85c75f..51b16cd27 100644 --- a/searx/templates/simple/preferences/tokens.html +++ b/searx/templates/simple/preferences/tokens.html @@ -3,7 +3,7 @@
{{- '' -}} {{- '' -}} + value='{{ preferences.tokens.get_value() }}'>{{- '' -}}
{{- '' -}}
{{- _('Access tokens for private engines') -}} From 8b8d830fd367386c5f06ae5a427028dc12642cd1 Mon Sep 17 00:00:00 2001 From: Markus Date: Sun, 15 Sep 2024 17:08:57 +0200 Subject: [PATCH 2/9] [fix] simple template: add ID to elements used for aria-labelledby The ``aria-labelledby`` [1] attribute identifies the element that labels the element it is applied to. The templates ``infinite_scroll.html`` and ``search_on_category_select.html`` define a ``aria-labelledby`` at the tag but miss the id in the
with the description. [1] https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby Signed-off-by: Markus --- searx/templates/simple/preferences/infinite_scroll.html | 2 +- .../templates/simple/preferences/search_on_category_select.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/searx/templates/simple/preferences/infinite_scroll.html b/searx/templates/simple/preferences/infinite_scroll.html index cda8008c9..4ed34e438 100644 --- a/searx/templates/simple/preferences/infinite_scroll.html +++ b/searx/templates/simple/preferences/infinite_scroll.html @@ -10,7 +10,7 @@ {%- endif -%}{{- ' ' -}} >{{- '' -}}

{{- '' -}} -
+
{{- _('Automatically load next page when scrolling to bottom of current page') -}}
{{- '' -}} {{- '' -}} diff --git a/searx/templates/simple/preferences/search_on_category_select.html b/searx/templates/simple/preferences/search_on_category_select.html index 76e970fa2..b7700b3b8 100644 --- a/searx/templates/simple/preferences/search_on_category_select.html +++ b/searx/templates/simple/preferences/search_on_category_select.html @@ -10,7 +10,7 @@ {%- endif -%}{{- ' ' -}} >{{- '' -}}

{{- '' -}} -
+
{{- _('Perform search immediately if a category selected. Disable to select multiple categories') -}}
{{- '' -}} {{- '' -}} \ No newline at end of file From 5ad0214bd42f6615fd0b171a96519ba55d826315 Mon Sep 17 00:00:00 2001 From: Markus Date: Sun, 15 Sep 2024 17:14:52 +0200 Subject: [PATCH 3/9] [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 -%} From 0b3724651eadade974a01902ca2c376a01325f53 Mon Sep 17 00:00:00 2001 From: Markus Date: Mon, 16 Sep 2024 15:46:35 +0200 Subject: [PATCH 4/9] [fix] simple template: drop useless ``aria-labelledby`` attributes This patch removes the ``aria-labelledby`` attributes for which there is no tag with the corresponding ID. Reported-by: @glanham-jr https://github.com/searxng/searxng/issues/3793#issuecomment-2351689483 Signed-off-by: Markus --- searx/templates/simple/preferences.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/searx/templates/simple/preferences.html b/searx/templates/simple/preferences.html index c04d442f2..825a98fe2 100644 --- a/searx/templates/simple/preferences.html +++ b/searx/templates/simple/preferences.html @@ -8,7 +8,7 @@ {%- macro tab_header(name, id, label, checked) -%} -
+
{%- endmacro -%} {%- macro tab_footer() -%} @@ -90,7 +90,7 @@ {{- '' -}} {%- if stats[engine_name].time != None -%} {{- stats[engine_name].time -}}{{- '' -}} -