Comfy-Org / Comfy-Org/ComfyUI_frontend

UX: Discoverability for expression mode in number prompts (placeholder + toast)

Open
#10,242 0 comments 0 reactions 1 assignee Claimed by @dante01yoon View on GitHub
area:i18n area:ui area:widgets enhancement
Dominant language
TypeScript
Stars
2k
Forks
704
Avg merge
1d 8h
Merged PRs (30d)
512

Description

Context
In PR #8985 we switched numeric widget prompts to use and added:
- Right‑click “Edit Expression”
- Slash (/) to switch the prompt to text mode for expressions

Feedback (from the PR review)
Typing expressions like 1+2*3 directly into a number input is silently rejected by the browser. Two ideas were suggested to improve discoverability:
1) Placeholder hint — e.g., “Press / for expressions”
2) Toast on math-symbol keypress — when a user types +, *, (, ), etc. into a number input, show a brief tip: “Press / to switch to expression mode”

Proposal
A. Placeholder (low risk, immediate)
- Extend PromptOptions with an optional placeholder?: string (avoid coupling LGraphCanvas.ts to i18n).
- In NumberWidget.onClick, pass placeholder via i18n (e.g., t('widgets.pressSlashForExpression')) along with inputType: 'number'.
- In LGraphCanvas.prompt, if options.placeholder exists, set input.placeholder = options.placeholder.

B. Contextual toast (opt‑in, short and non-blocking)
- In LGraphCanvas.prompt keydown handler, when input.type === 'number' and a “likely expression” key is pressed (+, -, *, (, ), ^, %), show a brief tip: “Press / to switch to expression mode.”
- Only display once per dialog open to avoid noise.
- Prefer existing toast utilities:
- Pinia store outside Vue components: /home/jailuser/git/src/platform/updates/common/toastStore.ts
- PrimeVue already wired in views (GraphView.vue), so store.add(...) will surface UI toasts.
- Keep the current “/” switch as the primary pathway.

Acceptance criteria
- Number prompts show a placeholder indicating the / shortcut when empty.
- Typing a math symbol in type=number shows a brief, non-intrusive hint (once per open).
- New i18n keys are added for the placeholder and toast text.
- Unit tests cover placeholder presence and the keydown hint path (mocked).
- No regressions to min/max/step, native controls, wheel/arrow behavior, and the / switch.

Open questions
- Any preference between store-based toast vs. a tiny inline hint in the dialog?
- Throttle beyond “once per dialog”?
- Final wording/i18n key placement (e.g., widgets.*).
- Should the planned “fx” toggle also show the hint on first open?

References
- PR: #8985
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/8985#discussion_r2946946096
- PR URL: https://github.com/Comfy-Org/ComfyUI_frontend/pull/8985

Requested by: @dante01yoon

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10242-UX-Discoverability-for-expression-mode-in-number-prompts-placeholder-toast-3276d73d365081acbf85fdabc3914725) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.