diff --git a/bookwyrm/static/css/format.css b/bookwyrm/static/css/format.css index 9d4b3105..92e0d92c 100644 --- a/bookwyrm/static/css/format.css +++ b/bookwyrm/static/css/format.css @@ -156,3 +156,35 @@ content: "\e905"; right: 0; } + +/** + * Accessibility (a11y) + ============================================================================ */ + +/** + * Skip links + * + * @see https://webaim.org/styles/main.css + ---------------------------------------------------------------------------- */ +.skip-link { + position: absolute; + opacity: 0; + z-index: 100; + padding: 6px; + border: 1px solid white; + color: white; + background: #BF1722; + transition: opacity 1s ease-out; +} + +.skip-link:focus { + opacity: 1; + outline-color: transparent; + transition: opacity .1s ease-in; +} + +@media (prefers-reduced-motion: reduce) { + .skip-link { + transition-duration: 0.001ms !important; + } +} diff --git a/bookwyrm/static/js/shared.js b/bookwyrm/static/js/shared.js index 7d65ee03..65f0dd65 100644 --- a/bookwyrm/static/js/shared.js +++ b/bookwyrm/static/js/shared.js @@ -8,9 +8,12 @@ window.onload = function() { Array.from(document.getElementsByClassName('interaction')) .forEach(t => t.onsubmit = interact); - // select all - Array.from(document.getElementsByClassName('select-all')) - .forEach(t => t.onclick = selectAll); + // Toggle all checkboxes. + document + .querySelectorAll('[data-action="toggle-all"]') + .forEach(input => { + input.addEventListener('change', toggleAllCheckboxes); + }); // tab groups Array.from(document.getElementsByClassName('tab-group')) @@ -136,9 +139,20 @@ function interact(e) { .forEach(t => addRemoveClass(t, 'hidden', t.className.indexOf('hidden') == -1)); } -function selectAll(e) { - e.target.parentElement.parentElement.querySelectorAll('[type="checkbox"]') - .forEach(t => t.checked=true); +/** + * Toggle all descendant checkboxes of a target. + * + * Use `data-target="ID_OF_TARGET"` on the node being listened to. + * + * @param {Event} event - change Event + * @return {undefined} + */ +function toggleAllCheckboxes(event) { + const mainCheckbox = event.target; + + document + .querySelectorAll(`#${mainCheckbox.dataset.target} [type="checkbox"]`) + .forEach(checkbox => {checkbox.checked = mainCheckbox.checked;}); } function toggleMenu(e) { diff --git a/bookwyrm/templates/import_status.html b/bookwyrm/templates/import_status.html index b28187b0..3ee9c4a5 100644 --- a/bookwyrm/templates/import_status.html +++ b/bookwyrm/templates/import_status.html @@ -5,7 +5,7 @@ {% block title %}{% trans "Import Status" %}{% endblock %} -{% block content %} +{% block content %}{% spaceless %}

{% trans "Import Status" %}

@@ -36,8 +36,15 @@ {% if not job.retry %}
{% csrf_token %} - -
-
- + + + + +
+ {% else %}
-{% endblock %} +{% endspaceless %}{% endblock %} diff --git a/locale/fr_FR/LC_MESSAGES/django.mo b/locale/fr_FR/LC_MESSAGES/django.mo index 2cddb793..2620d249 100644 Binary files a/locale/fr_FR/LC_MESSAGES/django.mo and b/locale/fr_FR/LC_MESSAGES/django.mo differ diff --git a/locale/fr_FR/LC_MESSAGES/django.po b/locale/fr_FR/LC_MESSAGES/django.po index 49f43c4c..1f85035b 100644 --- a/locale/fr_FR/LC_MESSAGES/django.po +++ b/locale/fr_FR/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-03-04 22:24+0000\n" +"POT-Creation-Date: 2021-03-05 14:10+0000\n" "PO-Revision-Date: 2021-03-02 12:37+0100\n" "Last-Translator: Fabien Basmaison \n" "Language-Team: Mouse Reeve \n" @@ -613,37 +613,42 @@ msgstr "(Rechargez la page pour mettre à jour !" #: bookwyrm/templates/import_status.html:35 msgid "Failed to load" -msgstr "Le chargement a échoué" +msgstr "Items non importés" -#: bookwyrm/templates/import_status.html:59 +#: bookwyrm/templates/import_status.html:42 +#, python-format +msgid "Jump to the bottom of the list to select the %(failed_count)s items which failed to import." +msgstr "Sauter en bas de liste pour sélectionner les %(failed_count)s items n’ayant pu être importés." + +#: bookwyrm/templates/import_status.html:74 msgid "Select all" msgstr "Tout sélectionner" -#: bookwyrm/templates/import_status.html:62 +#: bookwyrm/templates/import_status.html:79 msgid "Retry items" -msgstr "Essayer d’importer les objets sélectionnés de nouveau" +msgstr "Essayer d’importer les items sélectionnés de nouveau" -#: bookwyrm/templates/import_status.html:84 +#: bookwyrm/templates/import_status.html:101 msgid "Successfully imported" msgstr "Importation réussie" -#: bookwyrm/templates/import_status.html:88 +#: bookwyrm/templates/import_status.html:105 #: bookwyrm/templates/lists/curate.html:14 msgid "Book" msgstr "Livre" -#: bookwyrm/templates/import_status.html:91 +#: bookwyrm/templates/import_status.html:108 #: bookwyrm/templates/snippets/create_status_form.html:10 #: bookwyrm/templates/snippets/shelf.html:10 msgid "Title" msgstr "Titre" -#: bookwyrm/templates/import_status.html:94 +#: bookwyrm/templates/import_status.html:111 #: bookwyrm/templates/snippets/shelf.html:11 msgid "Author" msgstr "Auteur ou autrice" -#: bookwyrm/templates/import_status.html:117 +#: bookwyrm/templates/import_status.html:134 msgid "Imported" msgstr "Importé"