Revealjs line highlighting cannot meet WCAG contrast
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- css, javascript
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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).
- 主要语言
- JavaScript
- 星标
- 6.1k
- 派生
- 463
- 平均合并
- 21 小时 14 分钟
- 30 天内合并 PR
- 60
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
quarto-dev/quarto-cli 的其他 Issue
-
bug callouts regression revealjs
难度 2/5 1-3 小时 新手友好度 72/100
quarto-dev/quarto-cli#15014 ·
维护者通常 1 天内回复
-
Website navbar hides the notebook preview header可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭accessibility bug embed websites
难度 2/5 1-3 小时 新手友好度 78/100
quarto-dev/quarto-cli#14972 · 1 条评论 ·
维护者通常 1 天内回复
-
accessibility documentation revealjs
难度 2/5 1-3 小时 新手友好度 86/100
quarto-dev/quarto-cli#14971 ·
维护者通常 1 天内回复
-
accessibility revealjs
难度 2/5 1-3 小时 新手友好度 88/100
quarto-dev/quarto-cli#14970 · 1 条评论 ·
维护者通常 1 天内回复
-
a11y: notebook preview header is outside any landmark可能已有人在做 @cderv 于 2 天前认领。 未关闭accessibility embed
难度 1/5 1 小时以内 新手友好度 90/100
quarto-dev/quarto-cli#14968 ·
维护者通常 1 天内回复
查看 quarto-dev/quarto-cli 的全部 Issue
相似的 Issue
-
Harden bayesian-waves-bg.js: add prefers-reduced-motion, pointer-events guard, and hidden-tab pause未关闭
难度 2/5 1-3 小时 新手友好度 85/100
-
难度 1/5 1 小时以内 新手友好度 90/100
njitacm/njit-acm-website#109 ·
-
type: bug
难度 2/5 1-3 小时 新手友好度 76/100
blamechris/chroxy#8579 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
modusensus/dsh-mneme#411 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复