Skip to content

Add template_a11y.py to check icon-only links and buttons - #14

Merged
bonelifer merged 2 commits into
mainfrom
template-a11y-check
Oct 7, 2026
Merged

bonelifer merged 2 commits into
mainfrom
template-a11y-check

Conversation

@bonelifer

Copy link
Copy Markdown
Contributor

Adds phpbb-test-board/template_a11y.py, which scans an extension's or style's templates for links and buttons that show only an icon and reports any without a title (the tooltip) or screen-reader text (a <span class="sr-only"> or aria-label).

  • A title on the icon itself, phpBB's ACP pattern, counts as the tooltip, and a link around an image with alt text passes, so the check doesn't flag those.
  • Template syntax ({L_FOO}, {{ lang('FOO') }}, <!-- IF -->, {% if %}) is understood, so it works on phpBB 3.3 and Twig templates.
  • Output is FILE:LINE: message; exit status 1 if anything is found. Standard library only, no board needed.
  • The README and phpbb-test-board/README.md describe it, and tests/test-phpbb-test-board.sh covers it.

Testing
Claude added seven tests, which pass with the existing ones and ShellCheck. Run over the local phpbbmodders extension and style checkouts, it found one gap in sfscompanion (fixed in phpbbmodders/sfscompanion#10) and 29 in knowledgebase, which all have tooltips but lack screen-reader text.


Investigated and written by Claude on behalf of William Jacoby (bonelifer).

Scans an extension's or style's templates for links and buttons that
show only an icon, and reports any without a title (tooltip) or
screen-reader text (an sr-only span or aria-label). A title on the icon
itself, phpBB's ACP pattern, counts as the tooltip, and a link around an
image with alt text passes. Standard library only; no board needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bonelifer
bonelifer requested a review from kaileymsnay October 7, 2026 18:00
The ACP style has no sr-only class, so a span would be visible there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bonelifer
bonelifer merged commit 46490af into main Oct 7, 2026
1 check passed
@bonelifer
bonelifer deleted the template-a11y-check branch October 7, 2026 18:07
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.

1 participant