From 80e9f50e835eeb8dd8925b1e8eff3bef9ba82e63 Mon Sep 17 00:00:00 2001 From: JiaJia Ji Date: Fri, 25 Oct 2024 11:07:48 +0200 Subject: [PATCH] [Bug]: Fix playground autoComplete visual problem (#893) --- .../views/Feature/explorer.html.twig | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Resources/views/Feature/explorer.html.twig b/src/Resources/views/Feature/explorer.html.twig index 9f2e5ed8..aea05446 100644 --- a/src/Resources/views/Feature/explorer.html.twig +++ b/src/Resources/views/Feature/explorer.html.twig @@ -93,6 +93,27 @@ GraphQLPlayground.init(root, config); }); + + const observer = new MutationObserver((mutations) => { + mutations.forEach((mutation) => { + if (mutation.removedNodes.length) { + mutation.removedNodes.forEach((node) => { + if ( + node.tagName === "UL" && + node.classList.contains("CodeMirror-hints") + ) { + if (!node.parentElement && mutation.target.parentElement) { + mutation.target.parentElement.removeChild(mutation.target); + } + } + }); + } + }); + }); + observer.observe(document.body, { + subtree: true, + childList: true, + });