Icon-only links named by aria-label are silently dropped by HtmlTransformer

Open
#6,015 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
66/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
php
Domain
tooling

Research direction

Start at the HtmlTransformer entry point and locate its existing transformation tests. Trace how links with no text content are handled, then add neutral fixtures for icon-only links in a list item and a paragraph. Done when each control preserves its href and accessible name, or the run emits a named diagnostic.

Written by the indexing model from the issue text.

Description

Summary

HtmlTransformer drops a link whose only content is an icon element named through aria-label. The interactive control disappears silently: there is no text, so content conservation reports no loss, and no fallback diagnostic is emitted either.

Reproduction

(new HtmlTransformer())->transform('<ul class="pager"><li><a href="/journal/page/2/">2</a></li><li><a href="/journal/page/2/"><span class="icon icon-chevron-right" role="img" aria-label="Next" title="Next"></span></a></li></ul>')->toArray()['serialized_blocks'];

The output keeps only the 2 list item. The Next control and its list item are gone. The result is the same with or without an icon-font class on the span.

Real-world impact

On a captured Odoo blog listing, the pager's previous/next chevrons (<span class="oi oi-chevron-left|right" role="img" aria-label="Previous|Next">) vanish from the imported page. Only numbered links remain.

Expected

A link with an accessible name keeps its control. One option: preserve the icon element with its accessible name, for example as an icon-bearing link in rich text, with aria-label kept. If that is not representable, report an explicit diagnostic instead of dropping the control silently. When nothing else in the control carries text, conservation should treat the link's accessible name as text that must survive.

Acceptance

A neutral fixture covering an icon-only link inside a list item and in a paragraph. The control survives with its href and accessible name, or the run emits a named diagnostic.


Investigated and drafted by Claude Opus (Claude Code via Roadie) from a real import run.

Dominant language
PHP
Stars
28
Forks
5
Avg merge
2h 59m
Merged PRs (30d)
942

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Automattic/blocks-engine

All issues in Automattic/blocks-engine

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.