Repository navigation
[V3]: fix partially occluded clicks - #3491
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 202a1b4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Architecture diagram
sequenceDiagram
participant Client as Client Code
participant Locator as Locator
participant Session as CDP Session
participant Page as Page (DOM)
participant Browser as Browser Engine
Note over Client,Browser: Click/Hover/Tap/Centroid Operation
Client->>Locator: click() / hover() / tap() / centroid()
Locator->>Locator: resolveNode()
Locator->>Session: DOM.scrollIntoViewIfNeeded
alt bestEffortScroll (hover, centroid)
Session->>Browser: Scroll element into view
else standard (click, tap)
Session->>Browser: Scroll element into view
end
Locator->>Session: Runtime.callFunctionOn (findClickablePoint)
Session->>Page: Execute findClickablePoint script
Note over Page: Hit-testing algorithm
Page->>Page: Check element center at current scroll position
alt Center reachable
Page-->>Locator: {status: "ok", fx: 0.5, fy: 0.5}
else Center covered
Page->>Page: Scroll to center/end/start of viewport
Page->>Page: Re-check center after each scroll
alt Center reachable after scroll
Page-->>Locator: {status: "ok", fx: 0.5, fy: 0.5}
else Still covered
Page->>Page: Try off-center points
alt Off-center point reachable
Page-->>Locator: {status: "ok", fx: 0.25, fy: 0.5}
else All points covered
Page->>Page: Scroll to center, identify covering element
Page-->>Locator: {status: "covered", coveredBy: "div#footer"}
end
end
end
alt Hit-test successful
Locator->>Session: DOM.getBoxModel
Session->>Browser: Get element box model
Browser-->>Locator: Box model coordinates
Locator->>Locator: Map point onto border box
Locator->>Session: Input.dispatchMouseEvent (click/tap/hover)
Session->>Browser: Dispatch input event
Browser-->>Client: Click/hover completed
else Element covered (fallback)
Locator->>Locator: Log warning about covering element
Locator->>Session: DOM.getBoxModel
Session->>Browser: Get element box model
Browser-->>Locator: Box model coordinates
Locator->>Locator: Use center of content box
Locator->>Session: Input.dispatchMouseEvent (click at center)
Session->>Browser: Dispatch input event
Browser-->>Client: Event dispatched to covering element
end
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
miguelg719
approved these changes
Nov 18, 2026
Merged
seanmcguire12
pushed a commit
that referenced
this pull request
Nov 18, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to v3, this PR will be updated. # Releases ## @browserbasehq/[email protected] ### Patch Changes - [#3150](#3150) [`69c2440`](69c2440) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix OpenAI strict-schema rejection of the nullable `act` action while still stripping unknown keys when parsing. - [#3114](#3114) [`f6b3d85`](f6b3d85) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix CAPTCHA awareness options for local Browserbase attachments and forward them through the API. - [#3491](#3491) [`57b905e`](57b905e) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Fix clicks on partially occluded elements - [#3132](#3132) [`09063f6`](09063f6) Thanks [@shubh24](https://github.com/shubh24)! - Use automatic tool choice for the final agent `done` call with Claude Sonnet 5.5, Opus 5.5, and Fable 5.1. - [#3287](#3287) [`27ee07c`](27ee07c) Thanks [@akeimach](https://github.com/akeimach)! - Fix XPath resolution for light DOM elements when the page has a shadow root and a host element overrides `children`. ## @browserbasehq/[email protected] ### Patch Changes - Updated dependencies \[[`69c2440`](69c2440), [`f6b3d85`](f6b3d85), [`57b905e`](57b905e), [`09063f6`](09063f6), [`27ee07c`](27ee07c)]: - @browserbasehq/[email protected] ## @browserbasehq/[email protected] ### Patch Changes - [#3312](#3312) [`e11bbe5`](e11bbe5) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Rebuild the standalone server binaries with Node.js 24.22.1 and Undici 7.30.1 to include the October 2026 security fixes. Binary builds now reject outdated Node versions and rebuild instead of reusing cached executables. - Updated dependencies \[[`69c2440`](69c2440), [`f6b3d85`](f6b3d85), [`57b905e`](57b905e), [`09063f6`](09063f6), [`27ee07c`](27ee07c)]: - @browserbasehq/[email protected] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
why
locator.click()clicks in the center of an element. if there is something covering the center of that element, then the click lands on the thing covering itwhat changed
getClickPointhelper, which scrolls the element into view & decides which point to clickfindClickablePoint(called bygetClickPoint), which does hit testing. ie, it:<label>as reaching the elementgetClickPointmaps the chosen point onto the element's box model, so iframe offsets & transforms are handled as beforetest plan
locator-click-hit-target.spec.ts, which:find-clickable-point.spec.ts, which runs the page-side script directly & checks:Summary by cubic
Fixes clicks landing on elements overlapping the target.
click(),hover(), andtap()now hit-test the chosen point and scroll the element (under fixed footers, sticky headers, banners) to find a reachable one before dispatching input.centroid()intentionally stays at the box center even when covered.getClickPoint, shared by click, hover, and tap (not centroid), which scrolls into view and runs a newfindClickablePointin-page script.<label>s as reaching the element.Written for commit 202a1b4. Summary will update on new commits.