New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix getting parents/ancestors for shadow dom elements #8106
fix: Fix getting parents/ancestors for shadow dom elements #8106
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a bunch of traversals tests in #8166, a bunch of which still fail with these changes, could very well be something wrong with the tests though
User facing changelog
scrollIntoView
on an element in the shadow dom would throw the errorMaximum call stack size exceeded
.Additional details
In various places, we recursively walk up the dom tree using
$el.parent()
to find ancestors of$el
. When$el
is the root-most element in the shadow dom,$el.parent()
returns an empty jQuery object. This causes various issues, including a Range Error and visibility checks being wrong. This PR replaces instances of$el.parent()
with a more robust implementation that traverses out of the shadow dom to find ancestors when needed.PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?