grych / drab

Remote controlled frontend framework for Phoenix.

Home Page:https://tg.pl/drab

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Drab resets scroll position when updating DOM

kelostrada opened this issue · comments

Whenever I change any variables in Commander and I have some nested scroll which is in different then default position I will have DOM reloaded hence scrollTop will reset to 0. Is there any workaround to keep the scroll position?

I had the same issue creating naive chat, please take a look https://tg.pl/drab#chat_example. Simply, I just sent the JS:

broadcast_js socket, "document.querySelector('#chat').scrollTop = document.querySelector('#chat').scrollHeight"