{"record":{"id":"989a01b9ac01c74a","repo":"grafana/k6","slug":"pointer-action-w","errorCode":null,"errorMessage":"pointer action: %w","messagePattern":"pointer action: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/element_handle.go","lineNumber":1747,"sourceCode":"\t\t\t\tevalOptions{forceCallable: true, returnByValue: false},\n\t\t\t\tjs.ScrollIntoView,\n\t\t\t\tsopts,\n\t\t\t)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"scrolling element into view: %w\", err)\n\t\t}\n\n\t\t// Get the clickable point\n\t\tif p != nil {\n\t\t\tp, err = h.offsetPosition(apiCtx, opts.Position)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"getting element position: %w\", err)\n\t\t\t}\n\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","sourceCodeStart":1729,"sourceCodeEnd":1765,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/element_handle.go#L1729-L1765","documentation":"Pointer actions without an explicit position call clickablePoint, which takes the element's bounding box and returns its center. Failure means BoundingBox errored ('finding clickable point' — element hidden, detached, or cross-origin layout failure) or produced no usable box. Effectively: the element has no clickable center because it is not rendered with size.","triggerScenarios":"Element with zero width/height (empty inline spans, collapsed flex items); display:none ancestors; element detached between actionability check and point computation; bounding-box call failing across a swapping cross-origin iframe.","commonSituations":"Icon buttons that only get size after a webfont/CSS loads; placeholders rendered empty until data arrives; components collapsed by default CSS in test builds.","solutions":["Wait until the element has size: waitForSelector(sel, { state: 'visible' }) plus an optional boundingBox() size check","Fix the page CSS in test mode so the control has non-zero dimensions","Re-query the element right before the click to avoid stale handles","If only the event matters, el.dispatchEvent('click') bypasses pointer geometry entirely"],"exampleFix":"// before\npage.$('#icon-btn').click(); // zero-size icon until font loads\n\n// after\nconst el = page.waitForSelector('#icon-btn', { state: 'visible' });\nif (el.boundingBox()) el.click();","handlingStrategy":"validation","validationCode":"const el = page.waitForSelector('#icon-btn', { state: 'visible' });\nconst b = el.boundingBox();\nif (!b || (b.width === 0 && b.height === 0)) {\n  throw new Error('element has zero size; give it dimensions before clicking');\n}\nel.click();","typeGuard":null,"tryCatchPattern":"try {\n  el.click();\n} catch (e) {\n  if (String(e).includes('pointer action')) {\n    // no clickable center: fall back to a raw event\n    el.dispatchEvent('click');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Ensure icon/font CSS loads so controls have size","Check boundingBox for non-zero dimensions before clicking","Avoid clicking empty placeholders before data arrives"],"tags":["browser","bounding-box","actionability","pointer-events","layout"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}