Skip to content

Commit 6f9f405

Browse files
authored
Merge pull request #364 from FlowiseAI/FLOWISE-521-fix-detail-dialog-zIndex-bug
fix NodeDetailsDialog issue when opening in a container
2 parents 90effd0 + e8e739d commit 6f9f405

18 files changed

Lines changed: 169041 additions & 23 deletions

File tree

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,65 @@ You can also customize chatbot with different configuration
242242
</script>
243243
```
244244

245+
## Dialog Portal (`dialogContainer`)
246+
247+
By default, the `NodeDetailsDialog` (shown when clicking an agent node in the workflow tree view) renders inside the chatbot's shadow DOM. This means its `position: fixed` and `z-index` values are relative to the shadow host element, not the top-level page — which can cause the dialog to appear behind other page elements.
248+
249+
The `dialogContainer` prop lets you render the dialog into a host-page element instead, placing it in the document's stacking context so it always appears on top.
250+
251+
**Works with both `init` (popup) and `initFull` (full-page) embed modes.**
252+
253+
### Usage
254+
255+
Pass a CSS selector string or a direct `HTMLElement` reference:
256+
257+
```html
258+
<!-- Add a portal target anywhere in your page -->
259+
<div id="flowise-portal"></div>
260+
261+
<script type="module">
262+
import Chatbot from 'https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js';
263+
264+
// Using a CSS selector string
265+
Chatbot.init({
266+
chatflowid: '<chatflowid>',
267+
apiHost: 'http://localhost:3000',
268+
dialogContainer: '#flowise-portal',
269+
});
270+
271+
// Or pass a direct element reference
272+
Chatbot.init({
273+
chatflowid: '<chatflowid>',
274+
apiHost: 'http://localhost:3000',
275+
dialogContainer: document.getElementById('flowise-portal'),
276+
});
277+
</script>
278+
```
279+
280+
The same options apply to `initFull`:
281+
282+
```html
283+
<div id="flowise-portal"></div>
284+
<flowise-fullchatbot></flowise-fullchatbot>
285+
286+
<script type="module">
287+
import Chatbot from 'https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js';
288+
Chatbot.initFull({
289+
chatflowid: '<chatflowid>',
290+
apiHost: 'http://localhost:3000',
291+
dialogContainer: '#flowise-portal',
292+
});
293+
</script>
294+
```
295+
296+
### Notes
297+
298+
- The `NodeDetailsDialog` will only render if `chatWindow.showAgentMessages` is `true`
299+
- If `dialogContainer` is omitted, the dialog renders inline inside the shadow DOM (existing behaviour, no change).
300+
- In popup mode (`init`), if `dialogContainer` is not provided the dialog falls back to rendering inside the bubble's own container.
301+
- If a CSS selector string is provided but no matching element exists in the DOM at initialisation time, the dialog falls back to inline rendering and a warning is logged to the console.
302+
- The portal target element itself does not need any particular styling — the dialog uses `position: fixed` to position itself within the viewport.
303+
245304
## (Experimental) Proxy Server Setup
246305

247306
The Flowise Embed Proxy Server enhances the security of your chatbot implementation by acting as a protective intermediary layer. This server eliminates the need to expose sensitive Flowise instance details in your frontend code and provides several key security benefits:

dist/components/bubbles/BotBubble.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/constants.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/features/full/components/Full.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/utils/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ export declare const removeLocalStorageChatHistory: (chatflowid: string) => void
2121
export declare const getBubbleButtonSize: (size: 'small' | 'medium' | 'large' | number | undefined) => number;
2222
export declare const setCookie: (cname: string, cvalue: string, exdays: number) => void;
2323
export declare const getCookie: (cname: string) => string;
24+
export declare const resolveDialogContainer: (raw: unknown) => HTMLElement | undefined;
2425
export declare const getRecordingExtensionForMime: (mime: string) => string;
2526
//# sourceMappingURL=index.d.ts.map

dist/utils/index.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ declare const chatbot: {
77
chatflowConfig?: Record<string, unknown> | undefined;
88
observersConfig?: import("./components/Bot").observersConfigType | undefined;
99
theme?: import(".").BubbleTheme | undefined;
10+
dialogContainer?: string | HTMLElement | undefined;
1011
} & {
1112
id?: string | undefined;
1213
}) => void;
@@ -18,6 +19,7 @@ declare const chatbot: {
1819
chatflowConfig?: Record<string, unknown> | undefined;
1920
observersConfig?: import("./components/Bot").observersConfigType | undefined;
2021
theme?: import(".").BubbleTheme | undefined;
22+
dialogContainer?: string | HTMLElement | undefined;
2123
}) => void;
2224
destroy: () => void;
2325
clearChat: (id?: string | undefined) => void;

dist/web.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web.js

Lines changed: 84453 additions & 1 deletion
Large diffs are not rendered by default.

dist/web.umd.js

Lines changed: 84461 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)