Skip to content

Commit

Permalink
fix: context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed Apr 15, 2022
1 parent 0686232 commit 981fc40
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/machines/menu/src/menu.machine.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createMachine, guards, ref } from "@zag-js/core"
import { addPointerEvent, contains, isFocusable, nextTick, trackPointerDown } from "@zag-js/dom-utils"
import { addPointerEvent, contains, isFocusable, nextTick, raf, trackPointerDown } from "@zag-js/dom-utils"
import { getPlacement } from "@zag-js/popper"
import { getElementRect, getEventPoint, inset, withinPolygon } from "@zag-js/rect-utils"
import { add, isArray, remove } from "@zag-js/utils"
Expand Down Expand Up @@ -366,8 +366,10 @@ export const machine = createMachine<MachineContext, MachineState>(
if (!pt) return
const el = dom.getPositionerEl(ctx)
if (!el) return
Object.assign(el.style, { left: `${pt.x}px`, top: `${pt.y}px`, position: "absolute" })
ctx.isPlacementComplete = true
raf(() => {
Object.assign(el.style, { left: `${pt.x}px`, top: `${pt.y}px`, position: "absolute" })
ctx.isPlacementComplete = true
})
},
setSubmenuPlacement(ctx) {
if (ctx.isSubmenu) {
Expand Down

0 comments on commit 981fc40

Please sign in to comment.