Repository navigation
Conversation
bot.dom.getOverflowState() returns HIDDEN when an overflow:hidden ancestor clips the element, even when a scroll container between the element and that ancestor can scroll the element into view. This happens when the scroll container is taller (or wider) than the ancestor: elements in the band that the ancestor clips but the scroll container does not are reported as HIDDEN, so isDisplayed() returns false and getText() returns an empty string for them, while elements further down overflow the scroll container itself and are reported as SCROLL. When an overflow:hidden ancestor clips the element, now return SCROLL if a scroll container between them can still scroll in the needed direction and is not hidden itself. Reported against ChromeDriver as https://issues.chromium.org/issues/42321530
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
This branch has not been deployed
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.
🔗 Related Issues
Reported against ChromeDriver as https://issues.chromium.org/issues/42321530 (Get Element Text returns an empty string for one row of a table). There is no Selenium issue for it yet.
💥 What does this PR do?
bot.dom.getOverflowState()returnsHIDDENwhen anoverflow:hiddenancestor clips the element, even when a scroll container between the element and that ancestor can scroll the element into view. This happens when the scroll container is taller (or wider) than theoverflow:hiddenancestor, which is common in GWT-style layouts:Elements in the band that the outer div clips but the scroll container does not are reported as
HIDDEN, soisDisplayed()is false andgetText()returns"". Elements further down overflow the scroll container itself, are reported asSCROLLand keep their text. With the page attached to the Chromium bug, ChromeDriver returns text for rows 1-14 and 16-33 of a table and""for row 15.With this change, when an
overflow:hiddenancestor clips the element,getOverflowState()returnsSCROLLif a scroll container between the two can still scroll in the needed direction (forward for elements past the right/bottom edge, backward for elements before the left/top edge) and is not hidden itself. Otherwise it still returnsHIDDEN.🔧 Implementation Notes
overflow-x/overflow-yisautoorscrollare remembered per axis, closest first. When anoverflow:hiddencontainer hides the element, the closest remembered scroller on each hidden axis that can still scroll in the needed direction decides the result. If that scroller is itselfHIDDEN, the element staysHIDDEN.HIDDEN.getVisibleText. Rejected becauseisShown()has the same false negative, and the W3C Get Element Text and Is Element Displayed definitions both go through this function.Tests: three new tests in
javascript/atoms/test/overflow_test.html. They cover vertical and horizontal scrollers, a scroller that is already scrolled down, a scroller that cannot scroll, and a scroller that is itself hidden. I ran the atom test pages in headless Chrome 156 with a small harness that serves the tree the way the Bazel test server does (/filez/_main/), not through Bazel:overflow_test.htmlfails the 2 new positive tests (Expected: "scroll",Actual: "hidden"); with the fix, all 26 tests pass.shown_test,text_test,text_shadow_test,scrolling_test,click_test,clientrect_test,frame_scroll_test,interactable_size_testandwindow_scroll_into_view_testpass. The*_typescript_testpages need Bazel's TypeScript output and were not run.Chromium carries the same change in
third_party/selenium-atoms/patch.diffwith regenerated atoms and a ChromeDriver test: https://chromium-review.googlesource.com/c/chromium/src/+/8635549. There, the Chromium bug's page returns text for all 33 rows.🤖 AI assistance
dom.jschange, the tests, the commit message and this description. The PR was opened by the agent on the account owner's instruction.💡 Additional Considerations
None known. Chromium will drop its copy of the change from
patch.diffonce it updates the atoms to a Selenium revision that includes this.🔄 Types of changes