Revealjs line highlighting cannot meet WCAG contrast
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- css, javascript
- Domaine
- accessibility, documentation, frontend
Piste de recherche
Start with src/resources/formats/revealjs/plugins/line-highlight/line-highlight.css and reproduce the contrast measurements using the provided Quarto revealjs example. Review the Line Highlighting section of the revealjs documentation, then determine whether the completed change should document the limitation, provide an accessible emphasis method, or both; done means the documentation and any chosen presentation behavior address the stated WCAG concerns.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
In revealjs, code-line-numbers highlights lines by fading the other lines to opacity: 0.4 (line-highlight.css#L1-L7). The design comes from the reveal.js highlight plugin, which uses the same value.
At 0.4, the faded lines fail WCAG 1.4.3 Contrast (Minimum). With the default highlight theme on a white background, faded tokens are 1.7:1 to 2.6:1. The requirement is 4.5:1.
No other opacity value is a good fix. The token colors of the theme are close to 4.5:1 at full opacity, so they have almost no room to fade:
| Token | Color | Contrast at 1.0 | Contrast at 0.4 | Minimum opacity for 4.5:1 |
|---|---|---|---|---|
attribute (.at) |
#657422 | 5.15 | 1.74 | 0.94 |
import (.im) |
#00769e | 5.14 | 1.81 | 0.93 |
comment (.co) |
#5e5e5e | 6.48 | 1.85 | 0.85 |
| plain text | #111111 | 18.88 | 2.62 | 0.58 |
At 0.94, the highlighted line looks the same as the other lines. The feature then has no function.
The faded text is not exempt. WCAG gives an exemption only for "incidental" text, and the faded lines are content that the audience reads for context. Sometimes an earlier step shows all the lines at full opacity (code-line-numbers="|2|4-5"). This does not help a person in the audience, because that person cannot go back to the earlier step.
Suggestions
- Documentation: In the Line Highlighting section, tell authors that the fade does not meet WCAG contrast. Tell authors who need accessible slides not to use
code-line-numbersfor this purpose. - Investigate other methods: Show emphasis on the highlighted lines and keep the other lines at full contrast. Some possible methods are a background color, a left border, or a bold font weight. A method that uses only color must also meet 1.4.11 Non-text Contrast and 1.4.1 Use of Color. This can be a new default or an option.
Repro
---
format: revealjs
---
## Python
```{.python code-line-numbers="2|4-5"}
import numpy as np # a comment
x = np.linspace(0, 10, 100)
def f(x, k=2):
"""Docstring here."""
return x ** k + 3.5
```
Quarto 1.11.4, default revealjs theme. The contrast values come from the computed styles in Chrome.
AI tools helped with this investigation. The investigation used a local clone of quarto-cli (see "Using AI tools to investigate" in CONTRIBUTING.md).
- Langage dominant
- JavaScript
- Étoiles
- 6.1k
- Forks
- 463
- Merge moyen
- 21 h 14 min
- PR mergées (30 j)
- 60
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de quarto-dev/quarto-cli
-
bug callouts regression revealjs
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
quarto-dev/quarto-cli#15014 ·
Les mainteneurs répondent en général sous 1 jour
-
Website navbar hides the notebook preview headerPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverteaccessibility bug embed websites
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
quarto-dev/quarto-cli#14972 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
accessibility documentation revealjs
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
quarto-dev/quarto-cli#14971 ·
Les mainteneurs répondent en général sous 1 jour
-
accessibility revealjs
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
quarto-dev/quarto-cli#14970 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
a11y: notebook preview header is outside any landmarkPeut-être pris @cderv l’a pris il y a 2 jours. Ouverteaccessibility embed
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
quarto-dev/quarto-cli#14968 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de quarto-dev/quarto-cli
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
swc-project/swc#12516 ·
Les mainteneurs répondent en général sous 1 jour
-
feature-request
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
omegaup/omegaup#10323 · 1 commentaire ·
Les mainteneurs répondent en général sous 5 jours
-
area/frontend good first issue kind/cooldown
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
kestra-io/kestra#20702 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Form-data fields are not parsed when importing a cURL requestPeut-être pris @aayushbaluni l’a pris aujourd’hui. Ouvertebug status-new
Difficulté 2/5 1-3 heures Accessibilité débutants 69/100
Les mainteneurs répondent en général sous 1 jour
-
bug MVP
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
saayam-for-all/webapp#1911 ·
Les mainteneurs répondent en général sous 1 jour