floating-ui: isNative detection fails with NewRelic instrumentation

CodePen demo

https://codepen.io/jdelStrother/pen/LzrBXE

Steps to reproduce the problem

  1. Add NewRelic instrumentation, or any other instrumentation that wraps native functions (MutationObserver in particular)
  2. Try to display something with Popper

What is the expected behavior?

Popper uses MutationObserver and immediately displays the popped element at the correct position

What went wrong?

Popper’s isNative check fails, causing it to fall back to setTimeout(fn, 0), causing the popped element to appear for a split second at the wrong position, before moving into place once the timeout fires.

Any other comments?

window.MutationObserver.toString = function() { return "[native code]" } is a somewhat awful hack that works around Popper’s isNative check.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

@jdelStrother this was fixed with #461 and waiting on the next release.