I’ve noticed that MDG’s actual implementation of insert for UIHooks differs from their guides. This causes inconsistencies in how autoscrolling height measurements work.
Detailed in this Gist:
uihooks mdg
#When using UI Hooks, the docs will tell you to do it like this:
#This is wrong, but will work unless you are doing something that involves positioning. Namely autoscrolling behavior.
@find('#container')._uihooks = {
insertElement: ->
$(node).insertBefore(next)
#I researched how MDG does inserts themselves. They do it more like this:
#This works without an issue if you've implemented autoscrolling on this collection via template-level subscriptions.
#This is because this uses DOM insert rather than JQuery.
#It also, unfortunately, requires an additional piece of information - though one you likely already have! $('#container')
$('#container')[0].insertBefore(node, next)