fix(locator): treat elements inside visibility: hidden frames as hidden - #42722
Open
Mohan Ram (mohanram-dev) wants to merge 1 commit into
Open
Mohan Ram (mohanram-dev) wants to merge 1 commit into
Mohan Ram (mohanram-dev) wants to merge 1 commit into
Conversation
Mohan Ram (mohanram-dev)
force-pushed
the
fix/frame-visibility-hidden
branch
from
September 16, 2026 01:47
39eada9 to
35b4d49
Compare
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.
Fixes #42719
Description
When an
<iframe>or one of its ancestor containers in the parent document has \�isibility: hidden, elements rendered inside the iframe were previously reported as visible (\isVisible() === true, \ oBeVisible()\ passing, and actionability checks attempting clicks and hitting pointer interception timeouts).Root Cause
In \computeElementStyleVisibilityVisible()\ (\packages/injected/src/domUtils.ts), visibility was calculated solely within \element.ownerDocument. Because CSS inheritance of \�isibility: hidden\ does not traverse document boundaries, the inner iframe document creates a new root element which defaults to \�isibility: visible. Since \�isibility: hidden\ does not collapse layout boxes like \display: none\ does, \getBoundingClientRect()\ inside the iframe still reported non-zero dimensions.
Fix
In \computeElementStyleVisibilityVisible(), check if the element belongs to an enclosing frame via \element.ownerDocument?.defaultView?.frameElement. If present, check \isElementStyleVisibilityVisible(frameElement). This properly respects:
<iframe>element.Tests Added
Added test cases in \ ests/page/locator-is-visible.spec.ts\ validating: