Skip to content

fix(web): only open slash variable picker when / is typed (#39755) - #39761

Open
Souravrajvi0 wants to merge 1 commit into
langgenius:mainfrom
Souravrajvi0:feat/agent-slash-picker-click-33b5
Open

fix(web): only open slash variable picker when / is typed (#39755)#39761
Souravrajvi0 wants to merge 1 commit into
langgenius:mainfrom
Souravrajvi0:feat/agent-slash-picker-click-33b5

Conversation

@Souravrajvi0

@Souravrajvi0 Souravrajvi0 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

  • Open the workflow slash variable picker only when the user inserts / via text input
  • Ignore caret placement on existing / characters in prompt content (for example URLs)
  • Track slash intent with beforeinput and clear it on pointer clicks so re-clicking an old slash does not reopen the menu
  • Add regression coverage for typed / vs clicking after an existing slash in URL text

Fixes #39755

Root cause

ComponentPickerBlock used useBasicTypeaheadTriggerMatch with minLength: 0 for the / trigger. That matches any caret position immediately after an existing slash, so clicking inside URL text like https://... reopened the variable picker even though the user did not type /.

Impact

Workflow Agent prompt editing no longer opens the variable picker when users click inside existing prompt text that happens to contain /. Typing / still opens the picker as before, including when filtering with additional characters after the slash.

Screenshots

Before After
N/A — interaction fix verified with unit tests N/A — interaction fix verified with unit tests

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran targeted frontend unit tests for the changed prompt-editor picker path.

Validation

cd web && pnpm exec vp test run app/components/base/prompt-editor/plugins/component-picker-block/__tests__/index.spec.tsx
  • 20 passed (including regression test for typing / vs clicking after an existing slash)

Clicking the caret after an existing slash in prompt text (for example
in a URL) no longer opens the workflow variable picker. The slash menu
now opens only when the user inserts / via text input.

Fixes langgenius#39755
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. feat:webapp Ready-to-use AI web app. Also the "Preview" / "Debug & Preview" inside the orchestrate page. labels Jul 29, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Jul 29, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat:webapp Ready-to-use AI web app. Also the "Preview" / "Debug & Preview" inside the orchestrate page. lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflow Agent node prompt opens the variable picker when clicking anywhere after / on the same line

2 participants