Skip to content
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

Merged
merged 6 commits into from Aug 18, 2020

Conversation

chrisbreiding
Copy link
Contributor

@chrisbreiding chrisbreiding commented Jul 28, 2020

User facing changelog

  • Fixed an issue where call scrollIntoView on an element in the shadow dom would throw the error Maximum 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

  • Have tests been added/updated?
  • Has the original issue been tagged with a release in ZenHub?
  • N/A Has a PR for user-facing changes been opened in cypress-documentation?
  • N/A Have API changes been updated in the type definitions?
  • N/A Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 28, 2020

Thanks for taking the time to open a PR!

@chrisbreiding chrisbreiding changed the title Fix getting parents/ancestors for shadow dom elements fix: Fix getting parents/ancestors for shadow dom elements Jul 28, 2020
@chrisbreiding chrisbreiding requested review from a team, brian-mann, kuceb and JessicaSachs and removed request for a team and brian-mann July 28, 2020 14:24
@cypress
Copy link

cypress bot commented Jul 28, 2020



Test summary

8126 0 108 3


Run details

Project cypress
Status Passed
Commit f4a73eb
Started Aug 18, 2020 2:25 PM
Ended Aug 18, 2020 2:32 PM
Duration 06:40 💡
OS Linux Debian - 10.2
Browser Multiple

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

Copy link
Contributor

@panzarino panzarino left a 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

@chrisbreiding chrisbreiding merged commit 46714c5 into develop Aug 18, 2020
@chrisbreiding chrisbreiding deleted the tr-139-shadow-dom-scroll-max-call-stack branch April 5, 2022 18:29
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.

Range Error :Maximum call stack size exceeded when calling scrollIntoView on shadow DOM el
3 participants