How do I prevent window focus change when Meteor reactive template update from data subscription changes?

梦想与她 提交于 2020-01-02 17:18:18

问题


I have a long page. It contains references to templates, some of which render data.

One of the templates on the page is subscribed to a collection. When the collection changes the view in that template renders those items that have been added or changed. It does so quite nicely and doesn't reload the page.

The problem is that the focus of the page jumps to that template when data renders. The data the template renders is being updated by other users and the server. So, the user might not be viewing that part of the page when it renders incoming data and changes.

If the user is reading data further down the page when this template renders data the screen focus jumps back up to the reactive template area of the page where the data rendered. It is very annoying.

How to I prevent screen focus from jumping to the area that renders data on a long page?


回答1:


Meteor doesn't support the "autofocus" attribute at the moment. If you want to focus something on page load, you have to do it explicitly.



来源:https://stackoverflow.com/questions/10681918/how-do-i-prevent-window-focus-change-when-meteor-reactive-template-update-from-d

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!