Skip to content

Conversation

rinick
Copy link
Contributor

@rinick rinick commented Mar 24, 2019

This change uses ResizeObserver to detect size change when it's supported, otherwise fallback to the original method of window resize event.

This should fix ant-design/ant-design#15607 for chrome

Implementing a real resize listener for old browser is just too heavy. I think using ResizeObserver to fix chrome first and wait for other browser to adopt this feature is the best option.

@coveralls
Copy link

coveralls commented Mar 24, 2019

Coverage Status

Coverage increased (+0.04%) to 71.102% when pulling 3efb889 on rinick:observe-resize into f2c4289 on react-component:master.

} else {
// fallback to window resize event when ResizeObserver is not available
this.resizeEvent = addEventListener(window, 'resize', this.debouncedResize);
}
Copy link
Member

Choose a reason for hiding this comment

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

@rinick
Copy link
Contributor Author

rinick commented Mar 24, 2019

@afc163 done.
resize-observer-polyfill uses MutationObserver, it's not as heavy as I thought and not really targeting old browsers (< IE 11)
so yes, that's a much better choice than raw ReszieObserver

@afc163 afc163 merged commit 9bdadf5 into react-component:master Mar 25, 2019
@afc163
Copy link
Member

afc163 commented Mar 25, 2019

9.6.3

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.

Tabs component tab bar scroller cant detect size change properly
3 participants