 							Dom.text tr("sending")
 							renderDots()
 
+
 	typingSub = Obs.create {}
-	Server.send "typingSub", (delta) !-> typingSub.patch delta
-	Obs.observe !->
+	Server.send 'typingSub', (delta) !-> typingSub.patch delta
+	Obs.observe !->
+		wasNearBottom2 = Page.nearBottom()
 		users = []
 		for userId of typingSub.get()
 			if +userId isnt Plugin.userId()

			textAlign: 'center'

		Ui.button tr("Earlier messages"), !->
			firstV.modify (v) -> Math.max(1, (v||0)-10)
			if !Plugin.agent().ios # on ios, this results in content-not-rendered byg
				prevHeight = screenE.prop('scrollHeight')
				Obs.onStable !->
					delta = screenE.prop('scrollHeight') - prevHeight
					# does not account for case when contentHeight < scrollHeight
					Page.scroll Page.scroll() + delta

	Loglist.render firstV, shared.ref("maxId"), (num) !->
		Dom.div !->

				else
					Dom.text tr(" are typing")
				renderDots()
			if wasNearBottom2
				Page.scroll 'down', true

	Obs.observe !->
		mid = shared.get('maxId')
		if !isRendered || wasNearBottom
			Page.scroll 'down', isRendered # no scroll-animation on first render
		else if +shared.peek(0|mid/100, mid%100, 'by') != Plugin.userId()
			require('toast').show tr("Scroll for new message")

	###
	Dom._listen Dom._get().parentNode, 'scroll', !->
		if Page.nearBottom()
			require('toast').clear()
	###

	isRendered = true

	Page.setFooter !->
