@joewinke/jatui 0.2.23 → 0.2.24

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.
@@ -75,6 +75,17 @@ export function floating(node, options) {
75
75
  function applyPosition() {
76
76
  if (!opts.anchor)
77
77
  return;
78
+ // Anchor the element synchronously BEFORE the async computePosition
79
+ // refines it. computePosition resolves on a microtask, and until then a
80
+ // position:fixed element with auto left/top renders at its static flow
81
+ // position — observed in prod as a context menu stuck at the container's
82
+ // top-left instead of the cursor. The raw anchor rect is the correct
83
+ // coarse position (exact for virtual/cursor anchors); flip/shift then
84
+ // refine it when the promise lands.
85
+ const rect = opts.anchor.getBoundingClientRect();
86
+ node.style.position = 'fixed';
87
+ node.style.left = `${rect.left}px`;
88
+ node.style.top = `${rect.bottom + (opts.offset ?? 0)}px`;
78
89
  const middlewares = [];
79
90
  if (opts.offset != null)
80
91
  middlewares.push(fuOffset(opts.offset));
@@ -87,7 +98,6 @@ export function floating(node, options) {
87
98
  strategy: 'fixed',
88
99
  middleware: middlewares,
89
100
  }).then(({ x, y }) => {
90
- node.style.position = 'fixed';
91
101
  node.style.left = `${x}px`;
92
102
  node.style.top = `${y}px`;
93
103
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joewinke/jatui",
3
- "version": "0.2.23",
3
+ "version": "0.2.24",
4
4
  "private": false,
5
5
  "description": "Shared Svelte 5 component library for JAT projects",
6
6
  "type": "module",