fix: unfocus UI inputs on viewport click, refuse duplicate id in ID input#860
Merged
dmarcos merged 2 commits intoJul 14, 2026
Merged
Conversation
…nput raycaster.js preventDefault'ed every mousedown on the viewport, which canceled the browser's default focus transfer, so clicking the viewport never unfocused the currently focused panel input. Only preventDefault non-left buttons now (still needed so middle-click zoom doesn't trigger autoscroll) and add user-select none on the canvas to keep drag-orbits from starting a text selection, which the preventDefault was incidentally providing. changeId now refuses an id already used by another element (a duplicate id breaks entity lookups done with getElementById/querySelector) and shows a message below the input explaining the previous id was restored. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The .aframe-inspector-opened a-scene .a-canvas and .a-canvas.state-dragging rules are nested under #aframeInspector, and the canvas is not a descendant of it, so they never matched. Nothing in src adds the state-dragging class anyway. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Two improvements to the panel/viewport interaction:
Unfocus UI inputs when clicking the viewport
raycaster.jscalledevent.preventDefault()on every viewportmousedown, which cancels the browser's default focus transfer — so clicking the viewport never unfocused the currently focused panel input.preventDefault()non-left buttons now (still needed so middle-click zoom doesn't trigger the browser's autoscroll). Left-click performs the native focus transfer, so a focused input blurs — and commits its pending edit — before the selection changes.user-select: noneadded on the canvas, sincepreventDefault()was incidentally blocking drag-started text selection (drag-orbiting could otherwise select panel text).Refuse duplicate ids in the ID input
Typing an id that already belongs to another element was silently committed, producing a duplicate id in the document, which breaks entity lookups done with
getElementById/querySelector(selector-type component properties, links between entities, …).changeIdnow refuses such a value: a message is shown below the input and the input is remounted so it displays the entity's current id again.Dead CSS cleanup
The
.aframe-inspector-opened a-scene .a-canvasand.a-canvas.state-draggingrules inindex.stylare nested under#aframeInspector, and the canvas is not a descendant of it, so they never matched (nothing insrcadds thestate-draggingclass anyway). Removed; the newuser-selectrule lives underbody.aframe-inspector-opened, which does match.Tested
On the examples page with headless Chromium: viewport left-click blurs a focused id input; typing an existing id is refused with the message shown, and the message clears on entity switch; a valid rename still works and emits
entityidchange; canvasuser-selectisnone; middle/right-click stillpreventDefault.Same change on the aframe-editor fork: c-frame#79
🤖 Generated with Claude Code