Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A11Y: Amélioration de l'accessibilité des tooltip #5380

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hellodeloo
Copy link
Contributor

@hellodeloo hellodeloo commented Jan 13, 2025

🤔 Pourquoi ?

Les tooltips ne sont pas toujours activables à la tabulation

🍰 Comment ?

  • En remontant le data-bs-toggle="tooltip" sur les <a> qui enroberaient un <i data-bs-toggle="tooltip">
  • En remplaçant les <span> ou <div> possédant un data-bs-toggle="tooltip" par des quand c'était possible et en ajoutant sur un role="button" et tabindex="0"quand ça ne l'était pas

💻 Captures d'écran

Avant

capture 2025-01-13 à 10 48 41
capture 2025-01-09 à 17 12 33

Apres

capture 2025-01-13 à 10 48 50
capture 2025-01-13 à 15 20 52

@francoisfreitag
Copy link
Contributor

francoisfreitag commented Jan 13, 2025

En ajoutant sur un role="button" et tabindex="0" sur les <span>, <i> et <div> possédant un data-bs-toggle="tooltip"

La doc de bootstrap dit:

Keep tooltips accessible to keyboard and assistive technology users by only adding them to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). While other HTML elements can be made focusable by adding tabindex="0", this can create annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce tooltips in this situation.

Est-ce qu’on ne devrait pas changer le markup pour suivre ces recommendations ?

@hellodeloo hellodeloo force-pushed the deloo/fix-tooltip-a11y branch from 26100be to e20826a Compare January 13, 2025 15:29
@hellodeloo
Copy link
Contributor Author

Est-ce qu’on ne devrait pas changer le markup pour suivre ces recommendations ?

Pour les <span> et les <div>, oui, tu as raison, je vais remplacer par des <button> 👍
Pour les <i>, je vais voir si je peux en enrober certains dans un <button> mais ça ne sera surement pas possible pour tous

@hellodeloo hellodeloo force-pushed the deloo/fix-tooltip-a11y branch from 29b2a62 to 3d03510 Compare January 14, 2025 09:53
@hellodeloo hellodeloo force-pushed the deloo/fix-tooltip-a11y branch 3 times, most recently from 62d9f78 to a9781e7 Compare January 16, 2025 14:11
@hellodeloo hellodeloo marked this pull request as draft January 20, 2025 13:22
@hellodeloo hellodeloo force-pushed the deloo/fix-tooltip-a11y branch 2 times, most recently from 4454f80 to 2ccf1c8 Compare January 21, 2025 14:07
@hellodeloo hellodeloo added the 1-recette-jetable [Payé à l’heure] Crée une recette jetable sur CC label Jan 21, 2025
Copy link

🥁 La recette jetable est prête ! 👉 Je veux tester cette PR !

@hellodeloo hellodeloo marked this pull request as ready for review January 21, 2025 14:30
@hellodeloo hellodeloo force-pushed the deloo/fix-tooltip-a11y branch from 2ccf1c8 to 068bfbb Compare January 29, 2025 08:33
@hellodeloo hellodeloo removed the 1-recette-jetable [Payé à l’heure] Crée une recette jetable sur CC label Jan 29, 2025
@hellodeloo hellodeloo force-pushed the deloo/fix-tooltip-a11y branch from 068bfbb to f8bd32c Compare January 29, 2025 10:02
Copy link
Contributor

@francoisfreitag francoisfreitag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La meilleure accessibilité pour les tooltips est de les retirer...
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/tooltip_role

À discuter avec les UX, mais j’ai l’impression qu’on continue d’en ajouter.

data-bs-toggle="tooltip"
data-bs-placement="left"
data-bs-html="true"
data-bs-title="Une relance sera envoyée 3 jours après. <br> Vous pourrez renvoyer une invitation sous 10J."></i>
data-bs-title="Une relance sera envoyée 3 jours après. <br> Vous pourrez renvoyer une invitation sous 10J."
role="button"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi ne pas utiliser un bouton avec text-success ici ?

<strong>Une autre structure</strong>
</a>
{% else %}
<div data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Vous devez d’abord décliner la candidature pour pouvoir la transférer à un autre employeur">
<div data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Vous devez d’abord décliner la candidature pour pouvoir la transférer à un autre employeur" role="button" tabindex="0">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce dropdown me semble complètement inaccessible au clavier ?

Peut-être qu’une fois son markup corrigé (dans une autre PR), on pourrait en profiter pour utiliser un bouton ici ?

@@ -93,16 +93,18 @@ <h2 class="h4">Candidatures</h2>
{% if export_for == "siae" %}
<a class="btn btn-sm btn-link btn-ico-only"
{% matomo_event "candidature" "exports" "export-siae" %}
aria-label="Télécharger cet export SIAE au format .xlsx"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi déplacer le aria-label sur le <i>? C’est bien le lien qui déclenche le téléchargement, pas l’icone à l’intérieur.

(tous le fichier)

{% elif radio.data.value == RefusalReason.NO_POSITION %}
{{ radio.choice_label }}
<i class="ri-information-line ri-lg text-info ms-1" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="Si vous choisissez ce motif, les fiches de postes associées seront dépubliées."></i>
<button type="button" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="Si vous choisissez ce motif, les fiches de postes associées seront dépubliées.">
<i class="ri-information-line ri-lg text-info ms-1" aria-label="Si vous choisissez ce motif, les fiches de postes associées seront dépubliées."></i>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J’ai l’impression que ce tooltip ne devrait pas en être un. Le aria-label décrit l’élément <i>, ce qui n’est pas vraiment ce qu’on veut. Ni le bouton d’ailleurs.

Comment on lines +34 to +39
<i class="ri-information-line ri-xl text-info"
data-bs-toggle="tooltip"
data-bs-title="Cette date de fin est susceptible d’évoluer avec les éventuelles suspensions et prolongations du PASS IAE."
role="button"
tabindex="0">
</i>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

axeDevTools n’est pas heureux avec ce markup.
https://dequeuniversity.com/rules/axe/4.10/aria-command-name?application=AxeFirefox

To solve this problem, you need to fix at least (1) of the following:

L’élément n’a aucun contenu textuel visible par les lecteurs d’écran
L’attribut aria-label n’existe pas ou est vide
L’attribut aria-labelledby n’existe pas, fait référence à des éléments qui n’existent pas ou à des éléments vides ou non visibles
L’élément n’a pas d’attribut title

{% else %}
<a href="{% url 'apply:start_hire' company_pk=request.current_organization.pk %}" class="btn btn-lg btn-primary btn-ico" {% matomo_event "employeurs" "clic" "declarer-embauche" %}>
<i class="ri-user-follow-line fw-medium"></i>
<i class="ri-user-follow-line fw-medium" aria-hidden="true"></i>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J’ai l’impression qu’on pourrait faire une passe plus globale sur les icônes pour ajouter aria-hidden="true" partout.

@@ -23,7 +23,9 @@
<td>
{{ member.user.get_full_name }}
{% if member.user in active_admin_members %}
<span class="badge badge-xs rounded-pill bg-info" data-bs-toggle="tooltip" data-bs-title="Administrateur de la structure">admin</span>
<button type="button" class="badge badge-xs rounded-pill bg-info" data-bs-toggle="tooltip" data-bs-title="Administrateur de la structure">
admin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je me demande si on ne voudrait pas ajouter un <span class="visually-hidden">inistrateur</span> ou équivalent pour que les lecteurs d’écran n’emploient pas l’abbréviation ?

Comment on lines +44 to +46
<a href="{% url base_url|add:":update_admin_role" "add" member.user.pk %}" class="dropdown-item">Ajouter en tant qu'administrateur</a>
{% else %}
<a href="{% url base_url|add:":update_admin_role" "remove" member.user.pk %}" class="dropdown-item">
Retirer les droits d'administrateur
</a>
<a href="{% url base_url|add:":update_admin_role" "remove" member.user.pk %}" class="dropdown-item">Retirer les droits d'administrateur</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ces lignes n’ont pas été changées, serait-il possible de les laisser dans leur état d’origine ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants