Skip to content

fix: hide the redundant data-table search label - #2149

Merged
markdumay merged 3 commits into
mainfrom
fix/purge-visually-hidden
Aug 31, 2026
Merged

fix: hide the redundant data-table search label#2149
markdumay merged 3 commits into
mainfrom
fix/purge-visually-hidden

Conversation

@markdumay

Copy link
Copy Markdown
Collaborator

Adopts mod-simple-datatables v4.2.1 and adds the purge guard it depends on. Three commits, one patch release.

fix(deps) — adopt mod-simple-datatables v4.2.1

v4.2.0 pulled in a newer simple-datatables whose template wraps the search input in a label and renders labels.searchLabel above it. The module never set that label, so it fell through to the library's hard-coded English "Search" — a visible duplicate of the input's own Search... placeholder, untranslated on every locale. The same bump added labels.sortHint, equally left at its English default.

v4.2.1 hides the label with a visually-hidden span driven by i18n (the input is a child of the label, so hiding the element would hide the input) and localizes sortHint.

This is what fixes demo.gethinode.com, which is built from the exampleSite in production.

fix(styles) — keep visually-hidden out of the purge

The class now appears only inside the module's JavaScript, never in a layout, so hugo_stats.json cannot record it and PurgeCSS cannot see it. Safelisted beside the other classes SimpleDatatables applies at runtime. exampleSite/config/postcss.config.js re-exports this config, so both are covered.

Worth being precise about the risk: this is defensive, not load-bearing here. Control builds of the exampleSite with and without the entry produce a byte-identical main.min.d60305381e7ebfb….css, because core button/spinner/carousel markup already puts the class in the stats. It matters for a consumer site that renders none of those. Landing it in the same release as the bump means the class is never shipped unguarded.

fix(test) — vendor Hugo modules before the template tests

pnpm test fails on a tree that has never been vendored: test:templates resolves mod-utils partials through _vendor, so a fresh clone or worktree dies on utilities/InitArgs.html not found. CI never hit this because build:cache vendors first and only then calls test:templates — the gap is local, and the husky pre-commit hook runs straight into it.

Bound to test:templates rather than test, so a direct invocation is covered too. mod:vendor is the conditional wrapper, so it is a no-op once _vendor is current.

Verification

Production build of the exampleSite (pnpm build:example) against the published v4.2.1, no module replacement — 0 errors:

  • The visually-hidden span is present in the shipped, minified simple-datatables.en.min.*.js
  • .visually-hidden survives in the purged main.min.*.css
  • Rendered at -e production: the visible label is gone, the Search... placeholder is intact, and the search box now sits level with the per-page select
  • Accessibility tree still reports the input as a named searchbox — the label continues to name it, it is just not painted
  • Cold pnpm test:templates on a tree with _vendor deleted now vendors and passes; it failed before

Follow-up

gethinode.com is triggered by this release: its mod-update PR bumps hinode and mod-simple-datatables (it pins the latter directly too), and carries the same safelist entry since the site keeps its own PostCSS config rather than inheriting the theme's.

🤖 Generated with Claude Code

markdumay and others added 3 commits August 31, 2026 10:44
mod-simple-datatables hides the search input's label - which merely
repeats the input's own placeholder - by passing a `visually-hidden`
span as the label text. That class then lives only inside the module's
JavaScript, so hugo_stats.json never records it and PurgeCSS drops it.

Core layouts emit the class too, but only on pages that render a button,
spinner or carousel. A site with none of those would purge the rule and
put the duplicated label back on screen, in production builds only.

Safelist it alongside the other classes SimpleDatatables applies at
runtime. The exampleSite config re-exports this one, so both are covered.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`pnpm test` fails on a tree that has never been vendored: the template
tests build tests/templates, which resolves mod-utils partials through
`_vendor`, so a fresh clone or worktree dies on "utilities/InitArgs.html
not found". CI never hit this because build:cache vendors first and only
then calls test:templates - the gap is local, and the husky pre-commit
hook runs straight into it.

Bind the dependency to the script that actually needs it rather than to
`test`, so a direct `pnpm test:templates` is covered too. `mod:vendor`
is the conditional wrapper, so this is a no-op once `_vendor` is current.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Delivers the hidden, localized search label. v4.2.0 left the library's
`labels.searchLabel` at its hard-coded English default, so every data
table rendered a visible "Search" above the search input that merely
repeated the input's own placeholder. v4.2.1 replaces it with a
`visually-hidden` span driven by i18n, and localizes `labels.sortHint`
alongside it.

This is what fixes demo.gethinode.com, which is built from the
exampleSite in production. Landing it with the purge safelist entry in
one release keeps the class the module now depends on from ever
shipping unguarded.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Aug 31, 2026

Copy link
Copy Markdown

Deploy Preview for gethinode-demo ready!

Name Link
🔨 Latest commit b8a5241
🔍 Latest deploy log https://app.netlify.com/projects/gethinode-demo/deploys/6a9545f46bd89d000892ec71
😎 Deploy Preview https://deploy-preview-2149--gethinode-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@markdumay
markdumay enabled auto-merge August 31, 2026 09:16
@markdumay
markdumay merged commit 648bb95 into main Aug 31, 2026
17 checks passed
@markdumay
markdumay deleted the fix/purge-visually-hidden branch August 31, 2026 09:19
@markdumay

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 3.23.6 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant