ember-scrollable
ember-scrollable copied to clipboard
Prevent scroll when the element is resizing
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.
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...
@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
.