[simple] introduce page_with_header.html template

Previously the preferences & stats templates contained the markup:

<a href="{{ url_for('index') }}"><h1><span>SearXNG</span></h1></a>

There are many things wrong with this:

1. the markup was duplicated

2. the CSS needed to be changed whenever a new page wanted to use this
   header (since the CSS used page-specific selectors)

3. h1 should be reserved for the actual page title
   (e.g. Preferences or Engine stats)

4. the image was set via CSS which also set:

       span { visibility: hidden; }

   which however removes the alternative text from the accessibility
   tree (meaning screen readers will ignore it).

This commit fixes all these problems.
This commit is contained in:
Martin Fischer 2022-01-30 09:39:21 +01:00
parent 2a6d84dab5
commit 6f0ec7e58f
6 changed files with 17 additions and 28 deletions

View file

@ -1,7 +1,7 @@
{% from 'simple/macros.html' import tabs_open, tabs_close, tab_header, tab_footer, checkbox_onoff, checkbox %}
{% from 'simple/icons.html' import icon_big %}
{% extends "simple/base.html" %}
{% extends "simple/page_with_header.html" %}
{%- macro plugin_preferences(section) -%}
{%- for plugin in plugins -%}
@ -95,10 +95,7 @@
{% block head %} {% endblock %}
{% block content %}
<a href="{{ url_for('index') }}"><h1><span>SearXNG</span></h1></a>
<h2>{{ _('Preferences') }}</h2>
<h1>{{ _('Preferences') }}</h1>
<form id="search_form" method="post" action="{{ url_for('preferences') }}">