mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5081] [GUI] let the side panel's page preview use pointer lock #5303
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5303
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5081
Author: @storm-ace
Created: 11/3/2026
Status: 🔄 Open
Base:
main← Head:gui-preview-pointer-lock📝 Commits (1)
9b02b6cfix(host): let the HTML preview panel use pointer lock📊 Changes
2 files changed (+13 additions, -1 deletions)
View changed files
📝
apps/host/src/components/ArtifactPanel.tsx(+1 -1)➕
apps/host/tests/artifact-preview-sandbox.test.mjs(+12 -0)📄 Description
Problem and result
A web page that the agent writes opens in the side panel's preview. That preview is an iframe with
sandbox="allow-scripts". A page that captures the mouse callsrequestPointerLock(), for example a first-person game with "click to play". In that frame the call is refused with aSecurityError, so the game never starts in the desktop app. The same file works when it is opened in a browser tab.This adds
allow-pointer-lockto that one sandbox. The frame keeps its opaque origin: no same-origin access, forms, popups or top navigation. Pointer lock only starts after a click in the frame, and Esc releases it.Related discussion
I searched the open and closed issues and pull requests for "pointer lock" and "allow-pointer-lock" and found nothing that covers this.
Approach
apps/host/src/components/ArtifactPanel.tsx:sandbox="allow-scripts"becomessandbox="allow-scripts allow-pointer-lock"on the website preview iframe. Nothing else changes.apps/host/tests/artifact-preview-sandbox.test.mjs(new): checks that this iframe's sandbox has exactlyallow-scriptsandallow-pointer-lock. A wider sandbox would fail the test as well.HTML_PREVIEW_SANDBOX) are not changed. They show two versions side by side for comparison, not for play.Validation
Environment: Windows 11 Pro 10.0.26200, Node from the shipped app, this branch (upstream
ffa80d73plus this commit).Passed
The new test fails on
ffa80d73(actual: [ 'allow-scripts' ],expected: [ 'allow-pointer-lock', 'allow-scripts' ]) and passes with the change.npm run typecheckandnpm run buildinapps/host.A standalone page in Chromium with two
srcdocframes, each with a button that callsdocument.body.requestPointerLock():sandbox="allow-scripts"getsSecurityErrorandpointerlockerror;sandbox="allow-scripts allow-pointer-lock"gets past the sandbox check. In that run the browser window was in the background, so it then gotWrongDocumentError(no focus), not a lock.The desktop app on Windows (Radeon 8060S), with the same one-word change made in its installed bundle: a three.js first-person game in the side panel now captures the mouse after "click to play" and plays. Before the change, the click did nothing.
Failed
npm testinapps/host: 1,346 passed, 108 skipped, 3 failed. All 3 are outside this change:new hosts create the default; custom folders and legacy weights remain in place(model-directory-default.test.mjs)#4783 the composer acts on the choice, …(ui-do.test.mjs)directory API protects loaded models, active requests and downloads, …(model-directory.test.mjs)Running those three files again on
ffa80d73without this change, the first two fail the same way; the third passed that time.Not run
apps/desktop(Tauri) was not rebuilt; the change is only in the host's web UI.Limits
allowfullscreen) is not added. It was not needed for the case I hit, and it is a larger change to what a preview may do.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.