Navbar `logo-alt` is ignored when `logo` uses the `light`/`dark` form

Đang mở Phù hợp với người mới
#15,165 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript, yaml
Lĩnh vực
accessibility, frontend

Hướng nghiên cứu

Đọc src/project/types/website/website-shared.ts, nơi logo-alt được xử lý trước resolveLogo(), sau đó kiểm tra src/resources/projects/website/templates/navbrand.ejs và các bài kiểm tra liên quan đến việc hiển thị logo sáng/tối. Tái hiện bằng cấu hình YAML trong issue và kiểm tra các phần tử navbar <img> được tạo ra. Hoàn tất khi cả hai biến thể đều dùng logo-alt nếu không có văn bản thay thế riêng, đồng thời giữ nguyên văn bản thay thế được chỉ định rõ cho từng biến thể.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

accessibility bug website-navigation websites
I have:
  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide
Bug description

website.navbar.logo-alt only takes effect when logo is a plain string.
With logo: {light, dark}, the value is dropped silently and both <img> elements render with alt="".
The navbar logo link then has no accessible name.

website-shared.ts wraps the string into { path, alt } before calling resolveLogo(), and does nothing for the object form.
The sidebar has the same shape for sidebar.logo-alt.

navbrand.ejs reads alt from each variant and falls back to an empty string.

Neither the schema nor the documentation says that logo-alt only applies to the string form.
This is different from #14660, which is about the default when no alt text is given at all.

Steps to reproduce
---
title: "Logo alt test"
---

Content.

_quarto.yml:

project:
  type: website
website:
  navbar:
    logo:
      light: light.svg
      dark: dark.svg
    logo-alt: "Site name"
quarto render
grep -o '<img[^>]*navbar-logo[^>]*>' _site/index.html
Actual behavior
<img src="./light.svg" alt="" class="navbar-logo light-content">
<img src="./dark.svg" alt="" class="navbar-logo dark-content">

With logo: light.svg and the same logo-alt, the output is alt="Site name".
With logo: {light: {path: light.svg, alt: "Light alt"}, dark: {path: dark.svg, alt: "Dark alt"}}, each variant gets its own alt.

Expected behavior

logo-alt is applied to both variants when they have no alt of their own.
If that is not wanted, rendering should warn that logo-alt is ignored for the light/dark form, and the schema description should say so.

Your environment
  • IDE: none, terminal only
  • OS: macOS (Darwin 27.0.0, Apple Silicon)
Quarto check output
Quarto 99.9.9
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.10.0: OK
      Dart Sass version 1.101.0: OK
      Deno version 2.7.14: OK
      Typst version 0.15.1: OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: 69592e5c1718d3e1b2f3d11e757d32e23a16af67
Ngôn ngữ chính
JavaScript
Star
6.1k
Fork
478
Merge trung bình
17 giờ 53 phút
Pull request đã merge (30 ngày)
135

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của quarto-dev/quarto-cli

Tất cả issue của quarto-dev/quarto-cli

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.