{"record":{"id":"9afc8c778e685b61","repo":"grafana/k6","slug":"checking-hit-target-w","errorCode":null,"errorMessage":"checking hit target: %w","messagePattern":"checking hit target: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/element_handle.go","lineNumber":1762,"sourceCode":"\t\t} else {\n\t\t\tp, err = h.clickablePoint()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"pointer action: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\t// Further translation of the point might be necessary if the point\n\t\t// is still relative to the parent frame it is in and not the page.\n\t\t*p, err = h.translatePointToPage(apiCtx, *p)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"translating point to page: %w\", err)\n\t\t}\n\n\t\t// Do a final actionability check to see if element can receive events\n\t\t// at mouse position in question\n\t\tif !opts.Force {\n\t\t\tif ok, err := h.checkHitTargetAt(apiCtx, *p); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"checking hit target: %w\", err)\n\t\t\t}\n\t\t}\n\t\t// Are we only \"trialing\" the action but not actually performing\n\t\t// it (ie. running the actionability checks).\n\t\tif opts.Trial {\n\t\t\treturn nil, nil //nolint:nilnil\n\t\t}\n\n\t\tb := NewBarrier()\n\t\th.frame.manager.addBarrier(b)\n\t\tdefer h.frame.manager.removeBarrier(b)\n\t\tif res, err = fn(apiCtx, h, p); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"evaluating pointer action: %w\", err)\n\t\t}\n\t\t// Do we need to wait for navigation to happen\n\t\tif !opts.NoWaitAfter {\n\t\t\tif err = b.Wait(apiCtx); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"waiting for navigation: %w\", err)","sourceCodeStart":1744,"sourceCodeEnd":1780,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/element_handle.go#L1744-L1780","documentation":"Final actionability gate of pointer actions (non-force): checkHitTargetAt ran the injected hit-target check at the computed point and returned false — meaning another element intercepts pointer events there ('error:intercept' → 'another element is intercepting with pointer action'), or the check/its recursive frame walk errored. Note a message quirk: when the check returns false with a nil error, %w renders '%!w(<nil>)', which still means interception.","triggerScenarios":"Overlay, modal backdrop, cookie banner, sticky header, or toast covering the target point; element moved between point computation and hit test; nested iframe interception checks failing because a frame navigated.","commonSituations":"Autoplaying cookie/consent dialogs on EU pages; fixed footers overlapping content on small viewports; tooltips appearing on hover and covering the button; spinner overlays during async saves.","solutions":["Dismiss or wait out the covering element first (accept the banner, wait for the spinner to disappear)","If interception is expected/harmless, skip the check with force: el.click({ force: true })","Scroll the target fully into view so sticky headers do not overlap it, or click at a position clear of the overlay","Set an adequate timeout so the retry loop can wait for the overlay to close"],"exampleFix":"// before\npage.$('#submit').click(); // spinner overlay intercepts\n\n// after\npage.waitForSelector('.spinner', { state: 'hidden', timeout: '20s' });\npage.$('#submit').click();","handlingStrategy":"validation","validationCode":"const overlay = page.$('.modal-backdrop, .cookie-banner, .spinner');\nif (overlay && overlay.isVisible()) {\n  page.waitForSelector('.modal-backdrop, .cookie-banner, .spinner', { state: 'hidden', timeout: '20s' });\n}\nel.click();","typeGuard":null,"tryCatchPattern":"try {\n  el.click();\n} catch (e) {\n  const msg = String(e);\n  if (msg.includes('checking hit target') || msg.includes('intercepting')) {\n    el.click({ force: true }); // interception is expected/harmless\n  } else {\n    throw e;\n  }\n}","preventionTips":["Wait for known overlays (banners, spinners, toasts) to hide before clicking","Use force only after confirming interception is benign","Scroll targets fully into view so sticky bars do not cover them"],"tags":["browser","pointer-events","overlay","actionability","interception"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}