Skip to content

feat(plugin-a11y): load the in-page agent into hub hosts for a live host report#56

Open
antfubot wants to merge 1 commit into
mainfrom
great-buses-marry
Open

feat(plugin-a11y): load the in-page agent into hub hosts for a live host report#56
antfubot wants to merge 1 commit into
mainfrom
great-buses-marry

Conversation

@antfubot

@antfubot antfubot commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

What & why

The a11y inspector splits into a panel (the docked Solid SPA), a node backend, and an agent (dist/inject/inject.js) that runs axe-core inside the host page and talks to the panel over a same-origin BroadcastChannel. Both minimal hubs mounted the panel, but nothing ever loaded the agent into the host page — so the A11y Inspector sat permanently at "No page connected": no scan, no report, no highlight.

devframe deliberately keeps its hands off the host DOM ("the agent is the author-provided bridge"), so this gives hosts a first-class, opt-in way to wire the agent in.

Changes

  • @devframes/plugin-a11y
    • a11yAgent() (@devframes/plugin-a11y/vite) — serves the prebuilt agent bundle same-origin and injects its module script into the page Vite serves (dev-only; degrades to a console hint if the bundle isn't built).
    • a11yAgentBundlePath + A11Y_AGENT_PATH exports so any non-Vite host can serve the bundle and place the tag itself.
    • Panel's "No page connected" snippet now derives from the shared A11Y_AGENT_PATH.
  • Examples — both minimal hubs now show a live report of their own page: minimal-vite-devframe-hub adds a11yAgent(); minimal-next-devframe-hub serves the bundle through its catch-all route and loads it from the root layout.
  • Docs (plugin + both example READMEs) and a tsnapi snapshot refresh for the new exports; new unit test for a11yAgent().

Verified

Ran both hubs in a real browser: the agent is injected, the panel connects (websocket, axe 4.12.1), and lists live axe-core violations for the host page — Vite hub 2 serious, Next hub 1 serious color-contrast — with hover-to-highlight ringing the offending element in the host UI. pnpm lint, typecheck, test (537 passed), and build all green.

Created with the help of an agent.

…ost report

The docked A11y Inspector mounts its panel in the minimal hubs, but nothing
loaded the in-page agent into the host's own page, so the panel stayed stuck at
"No page connected" — no scan, no report, no highlight.

Give hosts a first-class way to bridge the agent in, honoring devframe's rule
that the agent is author-provided:

- `a11yAgent()` (from `@devframes/plugin-a11y/vite`) serves the prebuilt agent
  bundle same-origin and injects its module script into the page Vite serves.
- `a11yAgentBundlePath` and `A11Y_AGENT_PATH` are exported so any other host can
  serve the bundle and place the tag itself.

Wire both minimal hub examples to it — Vite via `a11yAgent()`, Next by serving
the bundle through the catch-all route and loading it from the root layout — so
the inspector now shows a live axe-core report of the hub's own page and
hover-to-highlight rings the offending element in the host UI.

Created with the help of an agent.
@netlify

netlify Bot commented Jul 1, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 7258db5
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a44a1878a8baf00087801ef
😎 Deploy Preview https://deploy-preview-56--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

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