chore(controller): reuse pointer xy

This commit is contained in:
Simon
2026-03-31 20:27:04 +08:00
parent 296459924a
commit 2b20b48dff
2 changed files with 16 additions and 10 deletions

View File

@@ -70,15 +70,15 @@ export async function clickElement(element: HTMLElement) {
const frame = element.ownerDocument.defaultView?.frameElement
if (frame) await scrollIntoViewIfNeeded(frame)
await movePointerToElement(element)
await clickPointer()
await waitFor(0.1)
const rect = element.getBoundingClientRect()
const x = rect.left + rect.width / 2
const y = rect.top + rect.height / 2
await movePointerToElement(element, x, y)
await clickPointer()
await waitFor(0.1)
// Hit-test to find the deepest element at click coordinates, matching
// real browser behavior where events target the innermost element.
// @note This may hit a element in the blacklist