当数据订阅更改 Meteor 反应式模板更新时,如何防止窗口焦点更改? [英] How do I prevent window focus change when Meteor reactive template update from data subscription changes?

查看:43
本文介绍了当数据订阅更改 Meteor 反应式模板更新时,如何防止窗口焦点更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很长的页面.它包含对模板的引用,其中一些模板呈现数据.

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?

推荐答案

Meteor 目前不支持自动对焦"属性.如果您想专注于页面加载,则必须明确地进行.

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.

这篇关于当数据订阅更改 Meteor 反应式模板更新时,如何防止窗口焦点更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆