]> git.agnieray.net Git - galette.git/commitdiff
Replace displaynone class with visually-hidden
authorGuillaume AGNIERAY <dev@agnieray.net>
Mon, 20 Nov 2023 22:14:44 +0000 (23:14 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Tue, 21 Nov 2023 06:29:48 +0000 (07:29 +0100)
refs #1735

When content needs to be read by screen readers

15 files changed:
galette/lib/Galette/Core/CheckModules.php
galette/lib/Galette/Core/Install.php
galette/templates/default/elements/edit_entitleds.html.twig
galette/templates/default/elements/edit_socials.html.twig
galette/templates/default/elements/navigate.html.twig
galette/templates/default/macros.twig
galette/templates/default/pages/configuration_payment_types.html.twig
galette/templates/default/pages/configuration_titles.html.twig
galette/templates/default/pages/contribution_form.html.twig
galette/templates/default/pages/contributions_list.html.twig
galette/templates/default/pages/history.html.twig
galette/templates/default/pages/mailings_list.html.twig
galette/templates/default/pages/preferences.html.twig
galette/templates/default/pages/transaction_form.html.twig
tests/Galette/Core/tests/units/CheckModules.php

index 770d7abceeb5be2d5abeaacf8dc6c8038c9f0450..e2e1daa40cada31982283c57093488208db85a0e 100644 (file)
@@ -138,7 +138,7 @@ class CheckModules
         if (count($this->missing) > 0) {
             $ko = ($translated ? _T('Ko') : 'Ko');
             foreach ($this->missing as $m) {
-                $html .= '<li><span>' . $m . '</span><span><i class="ui red times icon" aria-hidden="true"></i><span class="displaynone">' .
+                $html .= '<li><span>' . $m . '</span><span><i class="ui red times icon" aria-hidden="true"></i><span class="visually-hidden">' .
                     $ko . '</span></span></li>';
             }
         }
@@ -146,7 +146,7 @@ class CheckModules
         if (count($this->good) > 0) {
             $ok = ($translated ? _T('Ok') : 'Ok');
             foreach ($this->good as $m) {
-                $html .= '<li><span>' . $m . '</span><span><i class="ui green check icon" aria-hidden="true"></i><span class="displaynone">' .
+                $html .= '<li><span>' . $m . '</span><span><i class="ui green check icon" aria-hidden="true"></i><span class="visually-hidden">' .
                     $ok . '</span></span></li>';
             }
         }
index 0af9ae4a4f4860aeffcc0bbf40a23ce50516a6c5..30d12305923d03e70ebc707a958e276cf5be0a25 100644 (file)
@@ -166,7 +166,7 @@ class Install
     {
         $img_name = ($arg === true) ? 'green check' : 'red times';
         $alt = ($arg === true) ? _T("Ok") : _T("Ko");
-        $img = '<i class="ui ' . $img_name . ' icon" aria-hidden="true"></i><span class="displaynone">' . $alt . '</span>';
+        $img = '<i class="ui ' . $img_name . ' icon" aria-hidden="true"></i><span class="visually-hidden">' . $alt . '</span>';
         return $img;
     }
 
index dbd1eb32659aaf095ed769ada733d785624fc10f..4374e4ca3da82c8a89e74ebef7fb358ea7f5919c 100644 (file)
@@ -23,7 +23,7 @@
             <tfoot>
                 <tr>
                     <td data-scope="row">
-                        <span class="displaynone">
+                        <span class="visually-hidden">
 {% if class == 'Status' %}
                             {{ _T("New status") }}
 {% else %}
@@ -33,7 +33,7 @@
                     </td>
                     <td class="left" data-title="{{ _T("Name") }}">
                         <div class="required field">
-                            <label for="name" class="displaynone">{{ _T("Name") }}</label>
+                            <label for="name" class="visually-hidden">{{ _T("Name") }}</label>
                             <input size="40" type="text" name="{{ fields.libelle }}" required="required"/>
                         </div>
                     </td>
index 9d4fe126ff33e2f8e9a37bbff326ae04f3235b2c..64ead03e1b33a32561c329c317c185531d876364 100644 (file)
@@ -8,7 +8,7 @@
                     <input type="text" name="social_{{ social.id }}" id="social_{{ social.id }}" value="{{ social.url }}" class="large"/>
                     <a href="#" class="ui icon red button delete delsocial" title="{{ _T("Remove %type")|replace({"%type": social.getSystemType(social.type)})|e() }}">
                         <i class="trash icon" aria-hidden="true"></i>
-                        <span class="displaynone">{{ _T("Remove %type")|replace({"%type": social.getSystemType(social.type)})|e() }}</span>
+                        <span class="visually-hidden">{{ _T("Remove %type")|replace({"%type": social.getSystemType(social.type)})|e() }}</span>
                     </a>
                 </div>
             </div>
index 7336fbc0cc99a8c039d00c4d0ec196642e357d07..899807365e7a7712d0a10f0452d07679bf471ff3 100644 (file)
@@ -6,7 +6,7 @@
             title="{{ _T("Previous")|escape }}"
         >
             <i class="step backward icon" aria-hidden="true"></i>
-            <span class="displaynone">{{ _T("Previous") }}</span>
+            <span class="visually-hidden">{{ _T("Previous") }}</span>
         </a>
         <div class="item">{{ navigate.pos }} / {{ navigate.count }}</div>
         <a
@@ -14,7 +14,7 @@
             class="item{% if navigate.next is not defined %} disabled{% endif %}"
             title="{{ _T("Next")|escape }}"
         >
-            <span class="displaynone">{{ _T("Next") }}</span>
+            <span class="visually-hidden">{{ _T("Next") }}</span>
             <i class="step forward icon" aria-hidden="true"></i>
         </a>
     </nav>
index 90101d81a896fb009f57f43d66923aba56e0a2bb..67454392a52cf9409598d84a222f933f3e98b385 100644 (file)
@@ -6,7 +6,7 @@
     {% if mode == "compact" %}
         <div class="ui{% if cur_route in my_routes %} active-menu{% endif %} dropdown navigation item no-touch tooltip" data-html="{{ title }}" data-position="right center">
             <i class="{{ icon }} icon" aria-hidden="true"></i>
-            <span class="displaynone">{{ title }}</span>
+            <span class="visually-hidden">{{ title }}</span>
             <i class="dropdown icon" aria-hidden="true"></i>
             <div class="menu">
                 {% for item in items %}
@@ -72,7 +72,7 @@
             title="{{ title }}"
     >
         <i class="ui {{ icon }} icon" aria-hidden="true"></i>
-        <span class="displaynone">{{ title }}</span>
+        <span class="visually-hidden">{{ title }}</span>
     </a>
 {% endmacro %}
 
index f18caa954554e6174ae8649794bbcf34f8e28cc5..a6ffcded4964470676c9212c5f1fec24fc716053 100644 (file)
                     <tfoot>
                         <tr>
                             <td data-scope="row">
-                                <span class="displaynone">
+                                <span class="visually-hidden">
                                     {{ _T("Add payment type") }}
                                 </span>
                             </td>
                             <td class="left" data-title="{{ _T("Label") }}">
                                 <div class="required field">
-                                    <label for="name" class="displaynone">{{ _T("Name") }}</label>
+                                    <label for="name" class="visually-hidden">{{ _T("Name") }}</label>
                                     <input size="20" type="text" name="name" required="required"/>
                                 </div>
                             </td>
index 1c2d62c527d80d28e9825176ba0f14d7087f66a7..0aeeabf469384e4138d61ba509c9b17bd4432a83 100644 (file)
                 <tfoot>
                     <tr>
                         <td data-scope="row">
-                            <span class="displaynone">
+                            <span class="visually-hidden">
                                 {{ _T("Add title") }}
                             </span>
                         </td>
                         <td class="left" data-title="{{ _T("Short form") }}">
                             <div class="required field">
-                                <label for="short_label" class="displaynone">{{ _T("Short form") }}</label>
+                                <label for="short_label" class="visually-hidden">{{ _T("Short form") }}</label>
                                 <input size="20" type="text" name="short_label" required="required"/>
                             </div>
                         </td>
                         <td class="left" data-title="{{ _T("Long form") }}">
                             <div class="required field">
-                                <label for="long_label" class="displaynone">{{ _T("Long form") }}</label>
+                                <label for="long_label" class="visually-hidden">{{ _T("Long form") }}</label>
                                 <input size="20" type="text" name="long_label" required="required"/>
                             </div>
                         </td>
index 1cbda3b790d4d43f7fcff6de73523ab2dc65bcdd..8e0ad920a61a012c98dd1b191bc88a216bf736a4 100644 (file)
                                                 >
                                                     <i class="plus tiny icon" aria-hidden="true"></i>
                                                     <i class="user check icon" aria-hidden="true"></i>
-                                                    <span class="displaynone">{{ _T("Create a new fee that will be attached to the current transaction") }}</span>
+                                                    <span class="visually-hidden">{{ _T("Create a new fee that will be attached to the current transaction") }}</span>
                                                 </a>
                                                 <a
                                                     href="{{ url_for("addContribution", {"type": constant('Galette\\Entity\\Contribution::TYPE_DONATION')}) }}?trans_id={{ contribution.transaction.id }}"
                                                 >
                                                     <i class="plus tiny icon" aria-hidden="true"></i>
                                                     <i class="gift icon" aria-hidden="true"></i>
-                                                    <span class="displaynone">{{ _T("Create a new donation that will be attached to the current transaction") }}</span>
+                                                    <span class="visually-hidden">{{ _T("Create a new donation that will be attached to the current transaction") }}</span>
                                                 </a>
         {% endif %}
                                             </div>
index be5654a27e83c26fabe52e1df7a292dc19770a9f..f8e0022359f7d66362f33fb3d17c7eeb64e19bbd 100644 (file)
                         </span>
                     {% if contribution.isTransactionPart() %}
                         <i class="ui link icon" aria-hidden="true"></i>
-                        <span class="displaynone">{{ _T("Transaction: %s")|replace({"%s": contribution.transaction.description}) }}</span>
+                        <span class="visually-hidden">{{ _T("Transaction: %s")|replace({"%s": contribution.transaction.description}) }}</span>
                     {% endif %}
                 {% endif %}
                 {% if not contribution.isTransactionPart() %}
index 837a704bcc324271d02ea18245b99eccacc836a2..282c49070d990adde1255a5c8d87874eb84072af 100644 (file)
         <tr class="{% if loop.index % 2 == 0 %}even{% else %}odd{% endif %}">
             <td data-scope="row">
                 {{ loop.index }}
-                <span class="displaynone">
+                <span class="visually-hidden">
                         {{ _T("History entry %id")|replace({"%id": loop.index}) }}
                     </span>
             </td>
index 99b34f4245ceff233370afcc85b1f29f9b29cb68..b22f1c8106b15d8ad6813ad35da6042d05892329 100644 (file)
                 {% else %}
                     {{ loop.index }}
                 {% endif %}
-                <span class="displaynone">
+                <span class="visually-hidden">
                             {{ _T('Mailing entry %id')|replace({'%id': log.mailing_id}) }}
                         </span>
             </td>
index 01700108f7278708705cafe3a2e70ea2153da0b3..b10fb66faf83e0a7360b7637e6dd886829b0fd0f 100644 (file)
@@ -36,7 +36,7 @@
                                 title="{{ _T("Translate '%s'")|replace({'%s': pref.pref_slogan}) }}"
                             >
                                 <i class="language icon" aria-hidden="true"></i>
-                                <span class="displaynone">{{ _T("Translate '%s'")|replace({'%s': pref.pref_slogan}) }}</span>
+                                <span class="visually-hidden">{{ _T("Translate '%s'")|replace({'%s': pref.pref_slogan}) }}</span>
                             </a>
                         </div>
                     </div>
                                 title="{{ _T("Translate '%s'")|replace({"%s": pref.pref_card_abrev}) }}"
                             >
                                 <i class="language icon" aria-hidden="true"></i>
-                                <span class="displaynone">{{ _T("Translate '%s'")|replace({'%s': pref.pref_card_abrev}) }}</span>
+                                <span class="visually-hidden">{{ _T("Translate '%s'")|replace({'%s': pref.pref_card_abrev}) }}</span>
                             </a>
                         </div>
                         <span class="exemple">{{ _T("(10 characters max)") }}</span>
                                 title="{{ _T("Translate '%s'")|replace({"%s": pref.pref_card_strip}) }}"
                             >
                                 <i class="language icon" aria-hidden="true"></i>
-                                <span class="displaynone">{{ _T("Translate '%s'")|replace({'%s': pref.pref_card_strip}) }}</span>
+                                <span class="visually-hidden">{{ _T("Translate '%s'")|replace({'%s': pref.pref_card_strip}) }}</span>
                             </a>
                         </div>
                         <span class="exemple">{{ _T("(65 characters max)") }}</span>
index f1bcf27d414fbeea8e54821b638e1c7f07559d6a..684093a4867433aa6a4fb9b512c9886807e4bda3 100644 (file)
@@ -95,7 +95,7 @@
                                             >
                                                 <i class="plus tiny icon" aria-hidden="true"></i>
                                                 <i class="user check icon" aria-hidden="true"></i>
-                                                <span class="displaynone">{{ _T("Create a new fee that will be attached to the current transaction") }}</span>
+                                                <span class="visually-hidden">{{ _T("Create a new fee that will be attached to the current transaction") }}</span>
                                             </a>
                                             <a
                                                 href="{{ url_for("addContribution", {"type": constant('Galette\\Entity\\Contribution::TYPE_DONATION')}) }}?trans_id={{ transaction.id }}"
                                             >
                                                 <i class="plus tiny icon" aria-hidden="true"></i>
                                                 <i class="gift icon" aria-hidden="true"></i>
-                                                <span class="displaynone">{{ _T("Create a new donation that will be attached to the current transaction") }}</span>
+                                                <span class="visually-hidden">{{ _T("Create a new donation that will be attached to the current transaction") }}</span>
                                             </a>
                                             <a
                                                 href="#"
                                                 id="contribslist"
                                             >
                                                 <i class="receipt icon" aria-hidden="true"></i>
-                                                <span class="displaynone">{{ _T("Select an existing contribution in the database, and attach it to the current transaction") }}</span>
+                                                <span class="visually-hidden">{{ _T("Select an existing contribution in the database, and attach it to the current transaction") }}</span>
                                             </a>
                                         </div>
                                     </th>
index 214ae4730c617d189d20d06f0a297e8f360fdfb7..81d039b9eea1e9ff66ed450e2d009dcfb2c5a9aa 100644 (file)
@@ -102,7 +102,7 @@ class CheckModules extends TestCase
 
         $html = $checks->toHtml();
         $this->assertStringNotContainsString('green check icon', $html);
-        $this->assertSame(1197, strlen($html));
+        $this->assertSame(1221, strlen($html));
     }
 
     /**