Skip to content

Find element work for non hitTestable elements.#39

Open
IvanPalamarchuk wants to merge 1 commit intoAppiumTestDistribution:mainfrom
IvanPalamarchuk:feat/find_element_work_for_non_hitTestable
Open

Find element work for non hitTestable elements.#39
IvanPalamarchuk wants to merge 1 commit intoAppiumTestDistribution:mainfrom
IvanPalamarchuk:feat/find_element_work_for_non_hitTestable

Conversation

@IvanPalamarchuk
Copy link
Copy Markdown

@IvanPalamarchuk IvanPalamarchuk commented Mar 31, 2026

Hello!

I’d like to suggest some improvements to the library. > Our team has been using this approach for over a year now, and it has been working perfectly for us in production.

Subject: Improve visibility detection by adding a fallback for non-RenderBox elements

Description:
This PR enhances the visibility check logic to handle cases where hitTestable() might incorrectly return false for elements that are technically present on the screen.

While hitTestable() is effective for standard interactive elements, it has limitations in the following scenarios:

Non-RenderBox Elements: Widgets like SliverList, SliverGrid, InheritedWidget, or Builder do not have a RenderBox. The proposed logic ensures that if a RenderObject is not a RenderBox, we treat it as visible to allow traversal of its children.

Pointer Interactivity: Elements wrapped in IgnorePointer are visually present but fail hit-testing by design.

Edge Cases with Opacity & HitTestBehavior: Depending on the HitTestBehavior, elements with specific hit-test configurations might be skipped by hitTestable() even if they exist in the tree and visible on the screen.

Offstage Widgets: Provides a more predictable way to distinguish between widgets that are simply off-screen versus those explicitly hidden via Offstage.

Conclusion:
The isVisibleOnAppScreen() method acts as a necessary fallback. It ensures that the library doesn't skip elements that are visually or structurally important but "invisible" to the standard pointer-based hit-testing mechanism.

@IvanPalamarchuk IvanPalamarchuk marked this pull request as draft March 31, 2026 12:40
@IvanPalamarchuk IvanPalamarchuk marked this pull request as ready for review March 31, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant