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

🐛 [RUMF-1344] remove fallback for null scrollingElement #1694

Merged
merged 1 commit into from
Aug 17, 2022

Conversation

bcaudan
Copy link
Contributor

@bcaudan bcaudan commented Aug 16, 2022

Motivation

Following #1688, current fallback does not improve much the situation.

Changes

  • Remove fallback when scrolling element is null and don't handle document scroll in this case.
  • Remove try/catch around weakmap as it should not happen anymore

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@bcaudan bcaudan requested review from a team as code owners August 16, 2022 12:53
Comment on lines +8 to +16
if (element === document && !document.scrollingElement) {
// cf https://drafts.csswg.org/cssom-view/#dom-document-scrollingelement,
// in some cases scrolling elements can not be defined, we don't support those for now
return
}
scrollPositionsByElement.set(
element === document ? document.scrollingElement! : (element as Element),
scrollPositions
)
Copy link
Member

@BenoitZugmeyer BenoitZugmeyer Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥜 nitpick: ‏I feel writing it like that would be a tiny bit clearer, but either is fine

      if (element === document) {
        if (!document.scrollingElement) {
          // cf https://drafts.csswg.org/cssom-view/#dom-document-scrollingelement,
          // in some cases scrolling elements can not be defined, we don't support those for now
          return
        }
        element = document.scrollingElement
      }
      scrollPositionsByElement.set((element as Element), scrollPositions)

@bcaudan bcaudan merged commit c727be2 into main Aug 17, 2022
@bcaudan bcaudan deleted the bcaudan/telemetry-scroll-3 branch August 17, 2022 08:00
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.

3 participants