Skip to content

Fix empty item links in listings when a description contains a link - #15213

Merged
cderv merged 2 commits into
mainfrom
fix/listing-empty-anchors
Oct 27, 2026
Merged

cderv merged 2 commits into
mainfrom
fix/listing-empty-anchors

Conversation

@cderv

@cderv cderv commented Oct 27, 2026

Copy link
Copy Markdown
Member

When a listing item description contains a link, default and grid listings render empty, focusable <a> elements, flagged by axe-core (link-name), and part of the item no longer links to the item. This is a regression from 1.7, see #15211.

Root cause

The delink filter turns links inside a Div with the delink class into spans, so the whole description stays one link to the item. It only matches Pandoc Divs. The changes for #11758 (f9a5250, 43ff451) moved the <div class="delink listing-description"> container of the default and grid item templates into raw HTML blocks. The filter stopped running, and the description link ended up nested in the item link, which the browser splits into empty links.

Fix

The container is a fenced div again, ::: {.delink .listing-description} in the default template and ::: {.card-text .listing-description .delink} in the grid template, with only the item link kept as raw HTML, like the ::: {.body} div the template already uses. Markdown in descriptions keeps working, and the output is the same as in 1.6.

Links in descriptions not being clickable is the intended behavior, see #10814 where making them clickable is discussed as an option. So the links are turned into text again rather than kept.

Tests

A smoke-all project checks, for default and grid listings, that the description has no link, keeps the link text, and stays inside the item link.

Some tests from #9469 relied on the description link:

  • the listing axe test excluded the empty links, this exclusion is removed;
  • the test checking the external icon of the description link is removed, as there is no description link anymore;
  • the custom icon pagination test now uses a table listing, whose title link is the item link that keeps the external icon.

Fixes #15211

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

cderv added 2 commits October 27, 2026 16:02
Default and grid listings wrap the item description in the link to the
item, and the delink filter turns links inside the description into plain
text so the item link is not nested. The filter only matches Pandoc Divs.
Since 1.7, when the listing templates moved their HTML into raw blocks to
keep Markdown working in descriptions, the delink container has been a raw
HTML div, so the filter never ran. A description link then nested one <a>
in another, which the HTML parser splits into empty, unnamed links (axe
link-name, extra tab stops) and leaves part of the item outside its link.

Write the delink container as a fenced div again, keeping only the item
link as raw HTML, which matches the fenced divs the templates already use.
Output matches 1.6: the description link becomes a span inside one intact
item link.

Tests: a smoke-all project checks that default and grid descriptions have
no link, keep the link text, and stay inside the item link. The listing axe
test no longer excludes empty links. The description link icon test is
removed since the link no longer exists, and the custom icon pagination
test moves to a table listing, whose title link is the item link that
keeps its icon.
@posit-snyk-bot

posit-snyk-bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv cderv added this to the v1.11 milestone Oct 27, 2026
@cderv
cderv merged commit aad85b2 into main Oct 27, 2026
54 of 94 checks passed
@cderv
cderv deleted the fix/listing-empty-anchors branch October 27, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a11y: default and grid listings emit empty <a> when an item description contains a link (link-name)

2 participants