mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
* Fix preview iframe focus stealing * Fix preview focus guard for URL-loaded HTML previews Focus guard was only injected via the srcdoc path, but the default URL-load path bypasses buildSrcdoc entirely. Add htmlNeedsFocusGuard detection so focus-stealing HTML is routed through srcdoc where the guard can suppress window.focus/element.focus calls. * Widen focus guard detector to cover all .focus() call patterns The previous regex only matched window.focus() and document.focus(), missing document.body.focus(), querySelector().focus(), and other chained focus calls. Broaden to match any `.focus(` so the default URL-loaded preview path is forced to srcDoc for all focus-stealing HTML. * Conservatively force srcDoc for HTML with external script references When the HTML contains <script src=...>, we cannot inspect the linked file for focus-stealing calls. Force the srcDoc path so the focus guard intercepts any .focus() calls from external scripts. --------- Co-authored-by: JoeyZhu <15500388+acthenknow@user.noreply.gitee.com> |
||
|---|---|---|
| .. | ||
| app | ||
| public | ||
| sidecar | ||
| src | ||
| tests | ||
| next-env.d.ts | ||
| next.config.ts | ||
| package.json | ||
| postcss.config.mjs | ||
| tsconfig.json | ||
| tsconfig.sidecar.json | ||
| vitest.config.ts | ||