You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by en...@apache.org on 2025/11/04 15:01:00 UTC
(superset) 01/01: fix(ace-editor-popover): move autocomplete popover to parent elemnt
This is an automated email from the ASF dual-hosted git repository.
enzomartellucci pushed a commit to branch enxdev/fix/charts-add-custom-sql-query
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 46a89fc37e9dbbf4ea399dfd2672299d78c72c4a
Author: Enzo Martellucci <en...@gmail.com>
AuthorDate: Tue Nov 4 15:51:54 2025 +0100
fix(ace-editor-popover): move autocomplete popover to parent elemnt
---
.../src/components/AsyncAceEditor/index.tsx | 38 ++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/superset-frontend/packages/superset-ui-core/src/components/AsyncAceEditor/index.tsx b/superset-frontend/packages/superset-ui-core/src/components/AsyncAceEditor/index.tsx
index bdd9df8104..a7f1a16935 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/AsyncAceEditor/index.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/AsyncAceEditor/index.tsx
@@ -207,6 +207,44 @@ export function AsyncAceEditor(
}
}, [keywords, setCompleters]);
+ // Move autocomplete popup to the nearest parent container with data-ace-container
+ useEffect(() => {
+ const editorInstance = (ref as any)?.current?.editor;
+ if (!editorInstance) return;
+
+ const moveAutocompleteToContainer = () => {
+ const autocompletePopup = document.querySelector(
+ '.ace_autocomplete',
+ ) as HTMLElement;
+
+ if (autocompletePopup) {
+ const editorContainer = editorInstance.container;
+
+ const targetContainer = editorContainer?.parentElement;
+
+ if (targetContainer && targetContainer !== document.body) {
+ targetContainer.appendChild(autocompletePopup);
+ autocompletePopup.setAttribute('data-ace-autocomplete', 'true');
+ }
+ }
+ };
+
+ // Hook into Ace's command execution to detect when autocomplete starts
+ const handleAfterExec = (e: any) => {
+ if (e.command.name === 'insertstring') {
+ moveAutocompleteToContainer();
+ }
+ };
+
+ editorInstance.commands.on('afterExec', handleAfterExec);
+
+ return () => {
+ if (editorInstance.commands) {
+ editorInstance.commands.off('afterExec', handleAfterExec);
+ }
+ };
+ }, [ref]);
+
return (
<>
<Global