pack preference values in one
refactor the scroll observer

* extract the inner handler for readability
* simplify scanning scrollable elements for performance