A dashboard `logo` without `logo-alt` gives an unlabelled link and a `Q-10-2` warning about template variables

Aperta
#1,134 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
rust

Direzione di ricerca

Start in crates/quarto-core/src/dashboard/navbar.rs where logo variants receive alt, then trace the template access in crates/quarto-core/src/template.rs and the dashboard title or brand metadata available there. Reproduce with the supplied dashboard and compare q2’s output with Quarto 1. Done when the logo link has an accessible name where possible and missing names produce one actionable warning instead of two undefined-variable warnings.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug description

The dashboard from #1131 sets a logo and no logo-alt, and each q2 render ends with two template warnings about it.
The warnings point at a real problem, but they do not say what it is.

Without logo-alt, both q2 and Quarto 1 write the logo as the only content of a link, with alt="".
An empty alt marks the image as decorative, so the link has no accessible name, and a screen reader announces it as an unlabelled link.

q2 notices that alt is missing, but reports it as a template detail.
The navbar code adds an alt key to each logo variant only when logo-alt is set:

https://github.com/quarto-dev/q2/blob/8f17e950d26c68daae6e794c5fa513a96c0dae68/crates/quarto-core/src/dashboard/navbar.rs#L218-L225

The template then reads that key for both images, and the missing key becomes an undefined-variable warning:

https://github.com/quarto-dev/q2/blob/8f17e950d26c68daae6e794c5fa513a96c0dae68/crates/quarto-core/src/template.rs#L541-L542

Steps to reproduce

Put any logo.svg next to index.qmd:

---
title: Hello
format:
  dashboard:
    logo: logo.svg
---

## Row

Hello.
q2 render index.qmd
quarto render index.qmd
grep -o '<a href="#"><img[^>]*navbar-logo[^>]*></a>' index.html
Actual behavior

q2 prints:

Warning [Q-10-2]: Undefined variable: rendered.dashboard.logo.light.alt
Warning [Q-10-2]: Undefined variable: rendered.dashboard.logo.dark.alt
2 warnings

Quarto 1 prints nothing.
Both write the same links, with no accessible name:

<a href="#"><img src="logo.svg" alt="" class="navbar-logo light-content d-inline-block"></a>
<a href="#"><img src="logo.svg" alt="" class="navbar-logo dark-content d-inline-block"></a>
Expected behavior

The logo link has an accessible name even without logo-alt, for example from the document title or from the brand's meta.name.
When no name can be found, a single warning tells the author to set logo-alt, in place of two warnings about rendered.dashboard.logo.*.alt.

Your environment
  • q2: q2 (quarto 2) 0.43.0-nightly.20261109 (nightly built from 8f17e95), and q2 v0.42.0.
  • Quarto 1 for comparison: development build of quarto-dev/quarto-cli@fa74261.
  • OS: macOS 27.2 (arm64).
  • Terminal, no IDE.
Lingua principale
Rust
Stelle
302
Fork
22
Merge medio
5h 8m
PR unite (30g)
220

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di quarto-dev/q2

Tutte le issue di quarto-dev/q2

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.