Repository navigation
improvement(variables): focus the new variable's name field after adding it - #10065
Open
mofopeadegoke wants to merge 1 commit into
Open
mofopeadegoke wants to merge 1 commit into
mofopeadegoke wants to merge 1 commit into
Conversation
…ing it Clicking "Add new variable" left focus on the + button, so typing went nowhere and keyboard users had to hunt for the new row. Focus and select the new variable's Name input once it mounts, so the first keystroke replaces the default name. Only the client that clicked + moves focus; variables added by collaborators don't. Fixes simstudioai#10064 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Low impact] The change appears safe to merge. SummaryAdding a variable now focuses its Name field and selects the default name.
Reviews (1) · Last reviewed commit: "improvement(variables): focus the new va..." · Reviewed by Greptile |
This branch was previously deployed
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.
Summary
Clicking + ("Add new variable") in the Variables panel adds a variable with a default name (
variableN) but leaves focus on the button, so typing goes nowhere and you have to find and click the new row. This focuses the new variable's Name input and selects its default name, so the first keystroke replaces it.collaborativeAddVariablealready returns the new id;handleAddVariablenow keeps it in a ref, and a ref callback on the Name input focuses and selects that one row when it mounts (no effect needed). The pending id is cleared after use, so it fires once, and only in the client that clicked +: variables added by collaborators don't move focus.focus()also scrolls the row into view inside the panel.One file, +12 / −2.
Fixes #10064
Product update (if relevant)
Anyone adding workflow variables can name a new variable straight away, and the add flow now works from the keyboard (Tab → + → Enter → type).
Type of Change
Testing
Manually in dev mode (
bun run dev:full:capped), Windows 11, Google Chrome:Local gate:
bun run lint: passes.type-check:apps/simpasses (0 errors). The full parallel run ran out of memory on my machine (15 GB RAM), so I ran it withtsc --noEmit --singleThreaded. Thedocsworkspace fails on Windows for an unrelated reason (page paths are built withpath.relative, which gives backslashes); happy to open a separate issue.check:audits: 11 audits fail on Windows, and the same 11 fail on unmodifiedstagingon my machine (Windows path handling), so none come from this change.vitest relatedon the changed file: 1 file, 6 tests pass.check-block-registry.ts: passes (no block changes).--no-verify: the pre-push hook'slint:checkpassed, but itstype-checkalways fails on Windows because of thedocsissue above, whatever the change.No new unit test: per the repo's testing guidance, this is a focus/interaction change that's better shown by the clips below than by a test that restates the implementation. Happy to add one if you'd prefer.
Checklist
Screenshots/Videos
Before: focus stays on +; typing does nothing.
before-fix.mp4
After: the new variable's name is selected; typing replaces it.
after-fix.mp4