a11y: lightbox link of an off-theme `.light-content` or `.dark-content` image stays focusable

Aperta Adatta ai principianti
#15,170 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à
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, scss

Direzione di ricerca

Il report rimanda a src/resources/filters/layout/lightbox.lua e src/resources/formats/html/_quarto-rules.scss; leggi prima le regole per l’avvolgimento di lightbox e per nascondere i temi. Riproduci il comportamento con l’esempio QMD fornito, poi verifica che il link del tema disattivato sia nascosto nell’ordine di tabulazione da tastiera e nell’albero di accessibilità, mentre l’immagine corrispondente continui ad aprirsi. Nell’issue non è indicato alcun file di test.

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

Descrizione

accessibility bug
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

With a light and a dark version of an image, Quarto hides the one that does not match the colour scheme, but it leaves the lightbox link around it.
The hidden image's link is zero-size and invisible, yet it stays in the keyboard tab order, and pressing Enter on it opens the lightbox with the image from the other colour scheme.
Keyboard users tab onto an element they cannot see.

The lightbox filter wraps every lightbox image in an <a class="lightbox"> and puts no theme class on the link.

The stylesheet hides the image with display: none !important, and the rule only matches the image.

#14691 describes the same pattern for the dashboard navbar logo.

Steps to reproduce
---
title: "Lightbox light and dark test"
lightbox: auto
format:
  html:
    theme:
      light: default
      dark: darkly
---

![Light version](light.svg){.light-content}

![Dark version](dark.svg){.dark-content}

Render it, press Tab until the focus reaches the second image in light mode, then press Enter.

Actual behavior

The output contains one link per image, and the link of the off-theme image measures 0 by 0:

<a href="dark.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-2" title="Dark version"><img src="dark.svg" class="dark-content img-fluid figure-img" alt="Dark version"></a>

In light mode the tab order is: skip link, light image link, dark image link (invisible), lightbox close button.
In dark mode it is the same with the roles swapped.
Enter on the invisible link opens the lightbox with the hidden image.

Expected behavior

The link of the hidden image is hidden with it, so it leaves the tab order and the accessibility tree.

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
Lingua principale
JavaScript
Stelle
6.1k
Fork
478
Merge medio
17h 7m
PR unite (30g)
112

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/quarto-cli

Tutte le issue di quarto-dev/quarto-cli

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.