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

[Question] Why use scrollHeight in particular? #31

Closed
Titozzz opened this issue Sep 24, 2019 · 4 comments
Closed

[Question] Why use scrollHeight in particular? #31

Titozzz opened this issue Sep 24, 2019 · 4 comments
Labels
question Further information is requested wontfix This will not be worked on

Comments

@Titozzz
Copy link
Contributor

Titozzz commented Sep 24, 2019

This lib gets children size with scrollHeight but it can cause issues if that child contains something with a dropdown that would not be displayed but would still count towards scrollHeight.
We found workarounds in our use cases but we were wondering why this choice?
There are some alternatives: https://medium.com/@jbbpatel94/difference-between-offsetheight-clientheight-and-scrollheight-cfea5c196937

🚀

@roginfarrer
Copy link
Owner

Quite frankly I struggle to grasp the difference between all of them. If I recall correctly I tried each of them in the library, and landed with scrollHeight since it seemed to work without any issues. I'm open to a PR to change it if we can document a good reason for the change.

@roginfarrer
Copy link
Owner

Ah, I think I remember. When debugging #14, I discovered that when padding is applies to the collapse element, scrollHeight is the only measurement that is accurate. In this example, I changed the measurement to clientHeight, and it ends the transition prematurely.

See screenshot:

Screen Shot 2019-09-26 at 10 13 49 PM

@Titozzz
Copy link
Contributor Author

Titozzz commented Sep 27, 2019

I think offsetHeight might be what we want

@roginfarrer
Copy link
Owner

Closing this for now. Its stale, and I think scrollHeight leads to the most reliable behavior.

@roginfarrer roginfarrer added question Further information is requested wontfix This will not be worked on labels Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants