Revealjs line highlighting cannot meet WCAG contrast
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- css, javascript
- Ambito
- accessibility, documentation, frontend
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- JavaScript
- Stelle
- 6.1k
- Fork
- 466
- Merge medio
- 20h 30m
- PR unite (30g)
- 60
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di quarto-dev/quarto-cli
-
Revealjs: code block at the end of a callout lost its bottom spacing since 1.8.15Forse già presa @cderv l’ha presa oggi. Apertabug callouts regression revealjs
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
quarto-dev/quarto-cli#15014 ·
I maintainer di solito rispondono entro 1 giorno
-
accessibility documentation revealjs
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
quarto-dev/quarto-cli#14971 ·
I maintainer di solito rispondono entro 1 giorno
-
accessibility revealjs
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
quarto-dev/quarto-cli#14970 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
accessibility revealjs themes
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
quarto-dev/quarto-cli#14963 ·
I maintainer di solito rispondono entro 1 giorno
-
accessibility revealjs themes
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
quarto-dev/quarto-cli#14962 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di quarto-dev/quarto-cli
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
apache/rocketmq-dashboard#6610 ·
I maintainer di solito rispondono entro 3 giorni
-
ACK_WAITING HELP_WANTED UPDATE_CS
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OWASP/CheatSheetSeries#2781 ·
I maintainer di solito rispondono entro 1 giorno
-
Hermes: /ponytail off never reaches the model, the ruleset stays activeForse già presa @szsunyuan l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
DietrichGebert/ponytail#1121 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
integrations plugin
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
mem0ai/mem0#7622 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno