@sebgroup/green-core 3.21.1 → 3.21.2-rc.20260904080740058

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,10 @@ import { watch, watchMediaQuery } from "../../utils/decorators/index.js";
22
22
  import { ariaForwarding } from "../../utils/decorators/aria-forwarding.js";
23
23
  import { IconCrossSmall } from "../icon/icons/cross-small.component.js";
24
24
  import PopoverStyles from "./popover.styles.js";
25
+ function roundByDPR(value) {
26
+ const dpr = window.devicePixelRatio || 1;
27
+ return Math.round(value * dpr) / dpr;
28
+ }
25
29
  function applyTriggerAriaAttributes(trigger, open, popupRole) {
26
30
  trigger.setAttribute("aria-expanded", String(open));
27
31
  const focusableNodeNames = ["A", "BUTTON", "INPUT", "TEXTAREA"];
@@ -259,6 +263,9 @@ let GdsPopover = class extends GdsElement {
259
263
  (_a = __privateGet(this, _autoPositionCleanupFn)) == null ? void 0 : _a.call(this);
260
264
  this._elDialog?.style.removeProperty("left");
261
265
  this._elDialog?.style.removeProperty("top");
266
+ this._elDialog?.style.removeProperty("right");
267
+ this._elDialog?.style.removeProperty("bottom");
268
+ this._elDialog?.style.removeProperty("transform");
262
269
  this._elDialog?.style.removeProperty("minWidth");
263
270
  this._elDialog?.style.removeProperty("min-width");
264
271
  } else {
@@ -323,10 +330,18 @@ registerAutoPositioning_fn = function() {
323
330
  middleware: this.floatingUIMiddleware,
324
331
  strategy: "fixed"
325
332
  }).then(
326
- ({ x, y }) => Object.assign(floatingEl.style, {
327
- left: `${x}px`,
328
- top: `${y}px`
329
- })
333
+ ({ x, y }) => (
334
+ // Positioning via transform rather than left/top keeps the popover on its own
335
+ // compositing layer, which avoids a stale-paint bug in Safari when the placement
336
+ // flips while the popover is rendered outside the top layer (nonmodal mode).
337
+ Object.assign(floatingEl.style, {
338
+ left: "0",
339
+ top: "0",
340
+ right: "auto",
341
+ bottom: "auto",
342
+ transform: `translate3d(${roundByDPR(x)}px, ${roundByDPR(y)}px, 0)`
343
+ })
344
+ )
330
345
  );
331
346
  }));
332
347
  };