Warn loudly when a <wpd-*> tag is used without being imported#196
Merged
AllTerrainDeveloper merged 1 commit intoMay 13, 2026
Merged
Conversation
Collaborator
Author
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
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.

Why
A
<wpd-*>tag that appears in the DOM without a matchingcustomElements.define()renders as an inert generic element — noshadow root, no styles, no behavior, and no error. That silent
failure is the single most common reason a developer's UI "looks
broken for no reason," and the fix (one missing side-effect import)
is invisible from devtools.
This PR turns that silent failure into a loud, actionable
console.errorso the next developer who hits it loses minutes, nothours.
What it does
A new always-on warner watches the document and every open shadow
root. For any unregistered
<wpd-*>tag that doesn't get upgradedwithin ~2 seconds, it logs one of three messages:
import '<rel>/ui/components/<name>/<name>';line to paste.<wpd-buton>) — "Did you mean<wpd-button>?"via Levenshtein distance against the canonical tag list.
discover real names.
Each error attaches the offending element so devtools'
inspect-element jumps straight to it. One warning per tag per page —
not spammy.
How to test
Open OS Settings → Components. You'll see a new
"Missing-import warner — live demo" section. The console shows:
intentional.
console.errorentries, one per branch above.If you want the demo gone from your fork, delete the section in
src/settings/sections/help.ts— the warner itself stays.Scope
src/ui/components/missing-import-warner.ts— new module.src/desktop.ts— starts the warner beforeinit().src/settings/sections/help.ts— adds the demo section + banner.No public API changes. No behavior changes for end users.