Fix invisible drag line on Safari

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-06 19:18:09 +04:00
parent f9b0132614
commit 9b473b27c2
2 changed files with 7 additions and 2 deletions

View File

@@ -61,8 +61,13 @@ export function OptionsMenuTrigger({
const wrapper = document.createElement("div");
wrapper.append(hoveredBlock.cloneNode(true));
wrapper.style.position = "absolute";
wrapper.style.top = "-10000px";
wrapper.style.left = "-10000px";
wrapper.style.top = "0";
wrapper.style.minWidth = "1px";
wrapper.style.minHeight = "1px";
document.body.append(wrapper);
// Safari needs the element laid out before setDragImage
void wrapper.offsetHeight;
e.dataTransfer.setDragImage(wrapper, 0, 0);
document.addEventListener("dragend", () => wrapper.remove(), { once: true });
}

View File

@@ -8,7 +8,7 @@ export const optionsMenuVariants = tv({
slots: {
trigger: [
"z-20 flex size-5 items-center justify-center",
"rounded text-txt-tertiary hover:bg-subtle hover:text-txt-primary cursor-grab",
"rounded text-txt-tertiary hover:bg-subtle hover:text-txt-primary cursor-grab active:cursor-grabbing",
],
menu: ["rounded-lg border border-border-mid bg-level-0 p-1 shadow-mid z-30"],
},