Fix invisible drag line on Safari
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
@@ -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"],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user