From 6b9bce8a78a6377588fffbb86a6752a5fe178b70 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 20 Oct 2025 18:37:02 +0200 Subject: [PATCH] console/frontend: fix completion tooltip being wrapped with Firefox Firefox 144 fixed a long standing issue where offsetParent was not null for an element with `position: fixed` and it is now null (see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent). This breaks CodeMirror detection of transformed elements. Patch CodeMirror until this is fixed upstream. --- console/data/docs/99-changelog.md | 1 + .../patches/@codemirror__view@6.38.4.patch | 38 +++++++++++++++++++ console/frontend/pnpm-lock.yaml | 17 ++++++--- console/frontend/pnpm-workspace.yaml | 5 ++- 4 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 console/frontend/patches/@codemirror__view@6.38.4.patch diff --git a/console/data/docs/99-changelog.md b/console/data/docs/99-changelog.md index 1bf29d96..664c76c4 100644 --- a/console/data/docs/99-changelog.md +++ b/console/data/docs/99-changelog.md @@ -13,6 +13,7 @@ identified with a specific icon: ## Unreleased - 🩹 *inlet*: fix `akvorado_inlet_flow_input_udp_in_dropped_packets_total` metric +- 🩹 *console*: fix completion tooltip being wrapped with Firefox - 💥 *config*: stop shipping demo exporter configurations from the orchestrator - 🌱 *outlet*: be more aggressive when increasing the number of workers - 🌱 *outlet*: cap the number of workers to the number of Kafka partitions diff --git a/console/frontend/patches/@codemirror__view@6.38.4.patch b/console/frontend/patches/@codemirror__view@6.38.4.patch new file mode 100644 index 00000000..b7c4785e --- /dev/null +++ b/console/frontend/patches/@codemirror__view@6.38.4.patch @@ -0,0 +1,38 @@ +diff --git a/dist/index.cjs b/dist/index.cjs +index e9ca104998a1db31cc19c797d1e8a450a5807073..3603da43a97aec2a3dc4e947a000d1d55a07f30c 100644 +--- a/dist/index.cjs ++++ b/dist/index.cjs +@@ -10033,13 +10033,7 @@ const tooltipPlugin = ViewPlugin.fromClass(class { + let scaleX = 1, scaleY = 1, makeAbsolute = false; + if (this.position == "fixed" && this.manager.tooltipViews.length) { + let { dom } = this.manager.tooltipViews[0]; +- if (browser.gecko) { +- // Firefox sets the element's `offsetParent` to the +- // transformed element when a transform interferes with fixed +- // positioning. +- makeAbsolute = dom.offsetParent != this.container.ownerDocument.body; +- } +- else if (dom.style.top == Outside && dom.style.left == "0px") { ++ if (dom.style.top == Outside && dom.style.left == "0px") { + // On other browsers, we have to awkwardly try and use other + // information to detect a transform. + let rect = dom.getBoundingClientRect(); +diff --git a/dist/index.js b/dist/index.js +index 7915cd285c08b6bf3f221872ff98006bef30fc66..ed0fd377d18f75a2e1f9de20559656e7c08a6ba4 100644 +--- a/dist/index.js ++++ b/dist/index.js +@@ -10028,13 +10028,7 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class { + let scaleX = 1, scaleY = 1, makeAbsolute = false; + if (this.position == "fixed" && this.manager.tooltipViews.length) { + let { dom } = this.manager.tooltipViews[0]; +- if (browser.gecko) { +- // Firefox sets the element's `offsetParent` to the +- // transformed element when a transform interferes with fixed +- // positioning. +- makeAbsolute = dom.offsetParent != this.container.ownerDocument.body; +- } +- else if (dom.style.top == Outside && dom.style.left == "0px") { ++ if (dom.style.top == Outside && dom.style.left == "0px") { + // On other browsers, we have to awkwardly try and use other + // information to detect a transform. + let rect = dom.getBoundingClientRect(); diff --git a/console/frontend/pnpm-lock.yaml b/console/frontend/pnpm-lock.yaml index d003f6c9..c2843311 100644 --- a/console/frontend/pnpm-lock.yaml +++ b/console/frontend/pnpm-lock.yaml @@ -4,6 +4,11 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +patchedDependencies: + '@codemirror/view@6.38.4': + hash: 9bfcd4f367848d1f656593faf8482aae53d106fe7a236d7d21b9b7f4cfef5553 + path: patches/@codemirror__view@6.38.4.patch + importers: .: @@ -25,7 +30,7 @@ importers: version: 6.5.2 '@codemirror/view': specifier: ^6.0.0 - version: 6.38.4 + version: 6.38.4(patch_hash=9bfcd4f367848d1f656593faf8482aae53d106fe7a236d7d21b9b7f4cfef5553) '@headlessui/vue': specifier: ^1.6.1 version: 1.7.23(vue@3.5.22(typescript@5.9.2)) @@ -1770,20 +1775,20 @@ snapshots: dependencies: '@codemirror/language': 6.11.3 '@codemirror/state': 6.5.2 - '@codemirror/view': 6.38.4 + '@codemirror/view': 6.38.4(patch_hash=9bfcd4f367848d1f656593faf8482aae53d106fe7a236d7d21b9b7f4cfef5553) '@lezer/common': 1.2.3 '@codemirror/commands@6.8.1': dependencies: '@codemirror/language': 6.11.3 '@codemirror/state': 6.5.2 - '@codemirror/view': 6.38.4 + '@codemirror/view': 6.38.4(patch_hash=9bfcd4f367848d1f656593faf8482aae53d106fe7a236d7d21b9b7f4cfef5553) '@lezer/common': 1.2.3 '@codemirror/language@6.11.3': dependencies: '@codemirror/state': 6.5.2 - '@codemirror/view': 6.38.4 + '@codemirror/view': 6.38.4(patch_hash=9bfcd4f367848d1f656593faf8482aae53d106fe7a236d7d21b9b7f4cfef5553) '@lezer/common': 1.2.3 '@lezer/highlight': 1.2.1 '@lezer/lr': 1.4.2 @@ -1792,14 +1797,14 @@ snapshots: '@codemirror/lint@6.8.5': dependencies: '@codemirror/state': 6.5.2 - '@codemirror/view': 6.38.4 + '@codemirror/view': 6.38.4(patch_hash=9bfcd4f367848d1f656593faf8482aae53d106fe7a236d7d21b9b7f4cfef5553) crelt: 1.0.6 '@codemirror/state@6.5.2': dependencies: '@marijn/find-cluster-break': 1.0.2 - '@codemirror/view@6.38.4': + '@codemirror/view@6.38.4(patch_hash=9bfcd4f367848d1f656593faf8482aae53d106fe7a236d7d21b9b7f4cfef5553)': dependencies: '@codemirror/state': 6.5.2 crelt: 1.0.6 diff --git a/console/frontend/pnpm-workspace.yaml b/console/frontend/pnpm-workspace.yaml index 11d9f48a..d7d390d6 100644 --- a/console/frontend/pnpm-workspace.yaml +++ b/console/frontend/pnpm-workspace.yaml @@ -1 +1,4 @@ -minimumReleaseAge: 4320 # 3 days +minimumReleaseAge: 4320 + +patchedDependencies: + '@codemirror/view@6.38.4': patches/@codemirror__view@6.38.4.patch