Repository navigation
Fix empty item links in listings when a description contains a link - #15213
Merged
Merged
Conversation
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.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
delinkfilter turns links inside a Div with thedelinkclass 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:
Fixes #15211
Checklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.