From 5c9f2943816125097dc808552bf708ba90ea6819 Mon Sep 17 00:00:00 2001 From: Sam Beveridge Date: Tue, 1 Sep 2026 15:01:11 -0700 Subject: [PATCH 1/2] add hardcoded margin to prevent stylesheet overrides --- src/widgets/PopupWidget.ts | 1 + test/specs/PopupWidget.feature | 1 + test/tests/PopupWidget.test.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/widgets/PopupWidget.ts b/src/widgets/PopupWidget.ts index 23329d28..7d6ad31b 100644 --- a/src/widgets/PopupWidget.ts +++ b/src/widgets/PopupWidget.ts @@ -79,6 +79,7 @@ export default class PopupWidget extends Widget { dialog.setAttribute( "style", `width: 100%; min-width: ${minWidth}; max-width: ${maxWidth}; border: none; padding: 0;`, + `width: 100%; min-width: ${minWidth}; max-width: ${maxWidth}; border: none; padding: 0; margin: auto;`, ); const onClick = (e) => { e.stopPropagation(); diff --git a/test/specs/PopupWidget.feature b/test/specs/PopupWidget.feature index 9e7c1a39..e65f74a8 100644 --- a/test/specs/PopupWidget.feature +++ b/test/specs/PopupWidget.feature @@ -40,6 +40,7 @@ Feature: Pop-Up Widget | width | 100% | | border | none | | max-width | 500px | + | margin | auto | And the dialog is appended to the page body Then the widget is loaded into an iframe in the dialog element When '.open()' is called on the returned widget diff --git a/test/tests/PopupWidget.test.ts b/test/tests/PopupWidget.test.ts index b0612c87..f5883a11 100644 --- a/test/tests/PopupWidget.test.ts +++ b/test/tests/PopupWidget.test.ts @@ -141,6 +141,7 @@ describe("methods", () => { expect(dialog.style.maxWidth).toBe("500px"); expect(dialog.style.getPropertyValue("border")).toContain("none"); expect(dialog.style.padding).toBe("0px"); + expect(dialog.style.margin).toBe("auto"); const mockClose = vi .spyOn(dialog, "close") From 63e9389b3c2ab65f4705218e46f1909ad84efa28 Mon Sep 17 00:00:00 2001 From: Sam Beveridge Date: Wed, 2 Sep 2026 10:51:08 -0700 Subject: [PATCH 2/2] Update PopupWidget.ts --- src/widgets/PopupWidget.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/widgets/PopupWidget.ts b/src/widgets/PopupWidget.ts index 7d6ad31b..664692b6 100644 --- a/src/widgets/PopupWidget.ts +++ b/src/widgets/PopupWidget.ts @@ -78,7 +78,6 @@ export default class PopupWidget extends Widget { dialog.id = this.id; dialog.setAttribute( "style", - `width: 100%; min-width: ${minWidth}; max-width: ${maxWidth}; border: none; padding: 0;`, `width: 100%; min-width: ${minWidth}; max-width: ${maxWidth}; border: none; padding: 0; margin: auto;`, ); const onClick = (e) => {