I'm using purescript-halogen, and I want to scroll to bottom of div when the child component's message were caught. However, it seems not present that scroll action control in Halogen. So, how can I Scroll to bottom of div?
One solution I think is that call other, not Halogen, process from Main when the event caught. I'm not sure that this solution is not bad.
Setting the scroll position is just done through using the normal DOM functionality, targeting the rendered node.
To do this, you'll need to add a
refproperty in the HTML DSL to the node you want to scroll:And then in the
evalfor the component you can get hold of the actual DOM element created, usinggetHTMLElementRef, and then update the scroll position on that:The snippets here are modified from some real world code that does something similar, so should do the trick!