Variables cannot be inserted using the variable picker if users hold down the mouse button for more than 200 milliseconds #5864

Closed
opened 2026-02-21 18:12:55 -05:00 by yindo · 1 comment
Owner

Originally created by @kurokobo on GitHub (Sep 29, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.8.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Open any prompt editor
  2. Enter / or {, or click {x} button
  3. Move the mouse over any variable and hold down the mouse button for more than 200 ms

✔️ Expected Behavior

When the mouse button is released, the selected variable is inserted.

Actual Behavior

The variable picker is closed after 200 ms and the variable is not inserted when the mouse button is released.

The capture contains three slow clicks that take more than 200 ms (which failed to insert variables) and three fast clicks (which succeeded in inserting variables).

click_wf click_quick

Additional information

This has also been reported on Discord (I helped with the reporting as well).

Originally created by @kurokobo on GitHub (Sep 29, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.8.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Open any prompt editor 2. Enter `/` or `{`, or click `{x}` button 3. Move the mouse over any variable and hold down the mouse button for more than 200 ms ### ✔️ Expected Behavior When the mouse button is released, the selected variable is inserted. ### ❌ Actual Behavior The variable picker is closed after 200 ms and the variable is not inserted when the mouse button is released. The capture contains three slow clicks that take more than 200 ms (which failed to insert variables) and three fast clicks (which succeeded in inserting variables). ![click_wf](https://github.com/user-attachments/assets/c5fcaf40-0a75-425e-83c0-e6e1c90a9fa5) ![click_quick](https://github.com/user-attachments/assets/9c759e87-6ae6-4ac8-8292-0ee65a4bfe36) ### Additional information This has also been reported on [Discord](https://discord.com/channels/1082486657678311454/1280697871523643443/1280697871523643443) (I helped with the reporting as well).
yindo added the 🐞 bug label 2026-02-21 18:12:55 -05:00
yindo closed this issue 2026-02-21 18:12:55 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 29, 2024):

The issue with the variable picker closing after 200 milliseconds when the mouse button is held down is due to the onClick event handler in the VariablePickerMenuItem component. This handler calls the selectOptionAndCleanUp function, which closes the menu immediately upon clicking. Additionally, there is a debounce mechanism in the LexicalTypeaheadMenuPlugin component, which has a default debounce time of 200 ms for its triggerFn [1].

To address this issue, you might need to adjust the onClick handler or the debounce mechanism to ensure that the variable picker remains open long enough for the variable to be inserted when the mouse button is released.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 29, 2024): <!-- Answer --> The issue with the variable picker closing after 200 milliseconds when the mouse button is held down is due to the `onClick` event handler in the `VariablePickerMenuItem` component. This handler calls the `selectOptionAndCleanUp` function, which closes the menu immediately upon clicking. Additionally, there is a debounce mechanism in the `LexicalTypeaheadMenuPlugin` component, which has a default debounce time of 200 ms for its `triggerFn` <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/app/components/base/prompt-editor/plugins/variable-picker.tsx)</sup>. To address this issue, you might need to adjust the `onClick` handler or the debounce mechanism to ensure that the variable picker remains open long enough for the variable to be inserted when the mouse button is released. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5864