Skip to content

fix(prompt-editor): fix unexpected blur effect in prompt editor#34069

Merged
WTW0313 merged 6 commits intomainfrom
fix/editor-blur
Mar 26, 2026
Merged

fix(prompt-editor): fix unexpected blur effect in prompt editor#34069
WTW0313 merged 6 commits intomainfrom
fix/editor-blur

Conversation

@WTW0313
Copy link
Copy Markdown
Member

@WTW0313 WTW0313 commented Mar 25, 2026

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

Fixes #34047

Screenshots

Before:

20260325101923_rec_.mp4

After:

fixed.mp4

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 make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods

Copilot AI review requested due to automatic review settings March 25, 2026 08:09
@github-actions github-actions Bot added the web This relates to changes on the web. label Mar 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an unexpected blur-related UI effect in the prompt editor by removing the old “clear hide menu timeout” command flow and relocating blur/focus-driven menu visibility handling into the component picker plugin.

Changes:

  • Removed CLEAR_HIDE_MENU_TIMEOUT Lexical command and related dispatches/usages across prompt-editor plugins.
  • Simplified OnBlurBlock to stop scheduling delayed Escape dispatch on blur.
  • Added blur/focus-driven delayed hiding to ComponentPicker with new test coverage.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
web/eslint-suppressions.json Updates suppression count to reflect removed export.
web/app/components/base/prompt-editor/plugins/workflow-variable-block/index.tsx Removes CLEAR_HIDE_MENU_TIMEOUT command and dispatch on insert.
web/app/components/base/prompt-editor/plugins/workflow-variable-block/tests/index.spec.tsx Updates expectations after removing clear-timeout dispatch.
web/app/components/base/prompt-editor/plugins/update-block.tsx Stops importing/dispatching CLEAR_HIDE_MENU_TIMEOUT.
web/app/components/base/prompt-editor/plugins/on-blur-or-focus-block.tsx Removes delayed escape/timeout logic and related command registration.
web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx Introduces blur/focus delayed hiding logic scoped to the menu.
web/app/components/base/prompt-editor/plugins/component-picker-block/tests/index.spec.tsx Adds tests for new blur/focus menu visibility behavior.
web/app/components/base/prompt-editor/plugins/tests/update-block.spec.tsx Updates test to stop asserting clear-timeout behavior.
web/app/components/base/prompt-editor/plugins/tests/on-blur-or-focus-block.spec.tsx Updates tests to match simplified blur behavior and removes clear-timeout coverage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.98%. Comparing base (1789988) to head (e381761).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #34069   +/-   ##
=======================================
  Coverage   79.98%   79.98%           
=======================================
  Files        4609     4609           
  Lines      182624   182655   +31     
  Branches    35574    35577    +3     
=======================================
+ Hits       146069   146097   +28     
- Misses      33337    33340    +3     
  Partials     3218     3218           
Flag Coverage Δ
web 81.33% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI review requested due to automatic review settings March 25, 2026 08:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

web/app/components/base/prompt-editor/plugins/on-blur-or-focus-block.tsx:41

  • OnBlurBlock returns true for BLUR_COMMAND/FOCUS_COMMAND. In Lexical, returning true stops command propagation, which can prevent other plugins (e.g. the ComponentPicker’s new blur/focus handlers) from seeing these events depending on registration order. Consider returning false here after invoking the callbacks so other listeners can still run, unless you intentionally need to consume the command.
      editor.registerCommand(
        BLUR_COMMAND,
        (event) => {
          const target = event?.relatedTarget as HTMLElement
          if (!target?.classList?.contains('var-search-input')) {
            if (onBlur)
              onBlur()
          }
          return true
        },
        COMMAND_PRIORITY_EDITOR,
      ),
      editor.registerCommand(
        FOCUS_COMMAND,
        () => {
          if (onFocus)
            onFocus()
          return true
        },

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@WTW0313 WTW0313 marked this pull request as ready for review March 25, 2026 08:45
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. javascript Pull requests that update javascript code labels Mar 25, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Mar 26, 2026
@WTW0313 WTW0313 merged commit 6f3fcf2 into main Mar 26, 2026
28 checks passed
@WTW0313 WTW0313 deleted the fix/editor-blur branch March 26, 2026 02:53
WTW0313 added a commit that referenced this pull request Mar 26, 2026
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
WTW0313 added a commit that referenced this pull request Mar 30, 2026
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 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.

Unintended blurring effect observed in the prompt editor

3 participants