Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
360 views
in Technique[技术] by (71.8m points)

javascript - 如何在使用ngrx存储的angular4应用程序中保持对元素的关注(How to retain focus on elements in angular4 application which is using ngrx store)

On subscribing to store, variables in component might change leading to DOM updates loosing the focus on present active element

(订阅存储时,组件中的变量可能会发生变化,从而导致DOM更新,从而失去了对当前活动元素的关注)

I set the tabindex attributes on elements that need to be focused, but on clicking enter on few elements(simulates mouse click), my store gets updated, leading to DOM update, but my element is still there but as a fresh copy, so the reference is lost and also the focus gets shifted to body.

(我在需要重点关注的元素上设置了tabindex属性,但是在单击几个元素上的enter(模拟鼠标单击)后,我的商店就会更新,导致DOM更新,但是我的元素仍然在那里,但是作为一个新副本,所以失去参考,焦点也转移到身体上。)

Is there any way I can retain focus on the same element if it exists after DOM updates from store?

(从商店更新DOM后,如果存在相同的元素,我有什么办法可以保持关注?)

  ask by nithin guptha translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...