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

EuiResizeObserver fallback does not work for pure resizing #3044

Closed
chandlerprall opened this issue Mar 11, 2020 · 2 comments · Fixed by #3088
Closed

EuiResizeObserver fallback does not work for pure resizing #3044

chandlerprall opened this issue Mar 11, 2020 · 2 comments · Fixed by #3088

Comments

@chandlerprall
Copy link
Contributor

Discovered while working on #2991

Safari and IE11 are the two browsers we support which do not have ResizeObserver. For those, we fall back to a MutationObserver watching for all changes. While that catches when mutation cause a different size, it incorrectly:

  • misses size changes caused by a window resize
  • catches content changes that do not affect size
  • misses size changes caused by changes in a document's CSS

I don't think we should try addressing the third one, but wanted to include it for completeness. The other two should be fixed by changing the fallback to:

  • listen for resize events
  • confirm that a newly computed size is, in fact, different from the previously known one
@mridulgogia
Copy link
Contributor

There are two possible solutions:

  • We can check for hasResizeObserver in ComponentDidMount. If true, we can follow the code or if false, we can listen to an event of resize (supported by all browser).
  • We can use a resize event only as it is supported by every browser.

@PeterSenpai
Copy link
Contributor

Hi there, I have a PR up for the fix. Take a look when you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants