From a59700085e8f4d3266b9e75d96ea4cca60179ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Santos?= Date: Wed, 6 Sep 2023 00:57:55 +0100 Subject: [PATCH 1/2] Fix undefined `document.body` --- packages/ui/components/overlays/src/OverlayController.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/ui/components/overlays/src/OverlayController.js b/packages/ui/components/overlays/src/OverlayController.js index ec69981f80..db4210476f 100644 --- a/packages/ui/components/overlays/src/OverlayController.js +++ b/packages/ui/components/overlays/src/OverlayController.js @@ -103,9 +103,6 @@ async function preloadPopper() { return /** @type {* & Promise} */ (import('@popperjs/core/dist/esm/popper.js')); } -// @ts-expect-error [external]: CSS not yet typed -const supportsCSSTypedObject = window.CSS?.number && document.body.attributeStyleMap?.set; - /** * OverlayController is the fundament for every single type of overlay. With the right * configuration, it can be used to build (modal) dialogs, tooltips, dropdowns, popovers, @@ -808,7 +805,8 @@ export class OverlayController extends EventTarget { document.body.clientHeight - /** @type {number} */ (this.__bodyClientHeight); const newMarginRight = this.__bodyMarginRight + scrollbarWidth; const newMarginBottom = this.__bodyMarginBottom + scrollbarHeight; - if (supportsCSSTypedObject) { + // @ts-expect-error [external]: CSS not yet typed + if (window.CSS?.number && document.body.attributeStyleMap?.set) { // @ts-expect-error [external]: types attributeStyleMap + CSS.px not available yet document.body.attributeStyleMap.set('margin-right', CSS.px(newMarginRight)); // @ts-expect-error [external]: types attributeStyleMap + CSS.px not available yet From ed5e9374a7c771d8cd42e265679a39287e37eaf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Santos?= Date: Wed, 6 Sep 2023 10:58:32 +0100 Subject: [PATCH 2/2] Add changeset --- .changeset/dull-tools-protect.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/dull-tools-protect.md diff --git a/.changeset/dull-tools-protect.md b/.changeset/dull-tools-protect.md new file mode 100644 index 0000000000..dbab7a8b32 --- /dev/null +++ b/.changeset/dull-tools-protect.md @@ -0,0 +1,5 @@ +--- +'@lion/ui': patch +--- + +fix: undefined document.body