fix: hide the redundant data-table search label - #2149
Merged
Conversation
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>
✅ Deploy Preview for gethinode-demo ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Collaborator
Author
|
🎉 This PR is included in version 3.23.6 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
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.1v4.2.0 pulled in a newer
simple-datatableswhose template wraps the search input in a label and renderslabels.searchLabelabove 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 ownSearch...placeholder, untranslated on every locale. The same bump addedlabels.sortHint, equally left at its English default.v4.2.1 hides the label with a
visually-hiddenspan driven by i18n (the input is a child of the label, so hiding the element would hide the input) and localizessortHint.This is what fixes demo.gethinode.com, which is built from the exampleSite in production.
fix(styles)— keepvisually-hiddenout of the purgeThe class now appears only inside the module's JavaScript, never in a layout, so
hugo_stats.jsoncannot record it and PurgeCSS cannot see it. Safelisted beside the other classes SimpleDatatables applies at runtime.exampleSite/config/postcss.config.jsre-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 testspnpm testfails on a tree that has never been vendored:test:templatesresolves mod-utils partials through_vendor, so a fresh clone or worktree dies onutilities/InitArgs.html not found. CI never hit this becausebuild:cachevendors first and only then callstest:templates— the gap is local, and the husky pre-commit hook runs straight into it.Bound to
test:templatesrather thantest, so a direct invocation is covered too.mod:vendoris the conditional wrapper, so it is a no-op once_vendoris current.Verification
Production build of the exampleSite (
pnpm build:example) against the published v4.2.1, no module replacement — 0 errors:visually-hiddenspan is present in the shipped, minifiedsimple-datatables.en.min.*.js.visually-hiddensurvives in the purgedmain.min.*.css-e production: the visible label is gone, theSearch...placeholder is intact, and the search box now sits level with the per-page selectsearchbox— the label continues to name it, it is just not paintedpnpm test:templateson a tree with_vendordeleted now vendors and passes; it failed beforeFollow-up
gethinode.com is triggered by this release: its
mod-updatePR 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