Popover placement #15289

Closed
opened 2026-02-21 19:21:03 -05:00 by yindo · 1 comment
Owner

Originally created by @DavideDelbianco on GitHub (Jul 11, 2025).

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

1.6.0

Cloud or Self Hosted

Cloud, Self Hosted (Docker)

Steps to reproduce

  1. Create a code block with lots of variables and have lots of nodes before linked before that code block (to have many suggestions for variable picker)
  2. Enlarge the sidepanel editor to make the input textbox of the variables bigger
  3. Click on one of the inputs to open the variable picker

✔️ Expected Behavior

Should always be contained in the main editor area:

Image

Actual Behavior

overflows:
Image

Originally created by @DavideDelbianco on GitHub (Jul 11, 2025). ### 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 1.6.0 ### Cloud or Self Hosted Cloud, Self Hosted (Docker) ### Steps to reproduce 1. Create a code block with lots of variables and have lots of nodes before linked before that code block (to have many suggestions for variable picker) 2. Enlarge the sidepanel editor to make the input textbox of the variables bigger 3. Click on one of the inputs to open the variable picker ### ✔️ Expected Behavior Should always be contained in the main editor area: <img width="560" height="1053" alt="Image" src="https://github.com/user-attachments/assets/021cee87-3d5c-4f92-be0e-4bf1321845e0" /> ### ❌ Actual Behavior overflows: <img width="424" height="790" alt="Image" src="https://github.com/user-attachments/assets/ad73aede-11d1-40e4-8d21-e9edc699955a" />
yindo added the 🐞 bug label 2026-02-21 19:21:03 -05:00
yindo closed this issue 2026-02-21 19:21:03 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 11, 2025):

This overflow issue happens because the variable picker popover uses @floating-ui/react for placement, but does not set a boundary or containment constraint—so when the editor panel is enlarged, the popover can escape its intended area. The current middleware setup only uses offset, shift, and flip, which are not enough to keep the popover inside the editor panel [source].

To fix this, you can add the limitShift middleware with a boundary option to the useFloating config in the relevant component (like ComponentPickerBlock). For example:

import { limitShift } from '@floating-ui/react';

// Inside useFloating:
useFloating({
  placement: 'bottom-start',
  middleware: [
    offset(0),
    shift({ padding: 8, limiter: limitShift({ boundary: editorRef.current }) }),
    flip(),
  ],
});

You'll need to get a ref to the editor panel (e.g., using useRef in PromptEditor) and pass it as the boundary. Make sure the editor panel has position: relative or another suitable CSS property so it can act as a boundary.

Recent PRs have changed popover logic and display, but none have added containment logic or boundary constraints, so this is not yet addressed in the codebase [source].

If you can't use limitShift for some reason, you may need to adjust the popover's portal target or use CSS to clip overflow, but the middleware approach is the most robust.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jul 11, 2025): <!-- Answer --> This overflow issue happens because the variable picker popover uses @floating-ui/react for placement, but does not set a boundary or containment constraint—so when the editor panel is enlarged, the popover can escape its intended area. The current middleware setup only uses offset, shift, and flip, which are not enough to keep the popover inside the editor panel [[source]](https://github.com/langgenius/dify/blob/7f5087c6dbf491bf6a1b63bcb1e10fdec59e03ce/web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx). To fix this, you can add the limitShift middleware with a boundary option to the useFloating config in the relevant component (like ComponentPickerBlock). For example: ```js import { limitShift } from '@floating-ui/react'; // Inside useFloating: useFloating({ placement: 'bottom-start', middleware: [ offset(0), shift({ padding: 8, limiter: limitShift({ boundary: editorRef.current }) }), flip(), ], }); ``` You'll need to get a ref to the editor panel (e.g., using useRef in PromptEditor) and pass it as the boundary. Make sure the editor panel has position: relative or another suitable CSS property so it can act as a boundary. Recent PRs have changed popover logic and display, but none have added containment logic or boundary constraints, so this is not yet addressed in the codebase [[source]](https://github.com/langgenius/dify/pull/21729). If you can't use limitShift for some reason, you may need to adjust the popover's portal target or use CSS to clip overflow, but the middleware approach is the most robust. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/6280c642-d80a-4491-bd94-875162c2f919?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/6280c642-d80a-4491-bd94-875162c2f919?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/6280c642-d80a-4491-bd94-875162c2f919?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/6280c642-d80a-4491-bd94-875162c2f919?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6280c642-d80a-4491-bd94-875162c2f919?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/6280c642-d80a-4491-bd94-875162c2f919?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6280c642-d80a-4491-bd94-875162c2f919?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/22248)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15289