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

Prevent scroll when the element is resizing #56

Open
lancedikson opened this issue Feb 14, 2017 · 2 comments
Open

Prevent scroll when the element is resizing #56

lancedikson opened this issue Feb 14, 2017 · 2 comments

Comments

@lancedikson
Copy link

Hi there,
is it obligatory to have a ember-element-resize-detector as a dependency? And it could be very useful if it can save the position of scroll when the wrapping div is resizing.

@lancedikson
Copy link
Author

Oh, now I can see, ember-element-resize-detector used in templates. But still don't understand how to prevent scroll to top when the element is resized...

@alexander-alvarez
Copy link
Contributor

@lancedikson sorry I missed this notification, for some reason wasn't watching this repo.

Theoretically by setting scrollToY or scrollToX you would keep the scroll position even on resize, there seems to be a bug, where the scrollTo{X,Y} isn't being honored because of a bug here: https://github.com/alphasights/ember-scrollable/blob/master/addon/components/scroll-content-element.js#L179 basically the scrollbars are being recreated in the ember-scrollable component, so the DOM state is out of sync from the JS state.

see example here -- notice after scrolling and resizing -- as you describe the scrollToY is one value but in reality it is 0.
https://ember-twiddle.com/c04089ff252c750d81529fdf1114ef72?openFiles=templates.application.hbs%2C

I imagine some sort of syncing like one-way-input has to deal with https://github.com/DockYard/ember-one-way-controls/blob/master/addon/components/one-way-input.js#L44..L83 (was just looking at this code today, hence I pulled the reference)

is this something you're willing to contribute a patch to help out with?

we might also want to expose the resize events, so that users who don't want this behavior can manually set their scrollTo{X,Y} to 0.

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

No branches or pull requests

2 participants