简体   繁体   English

如何在 jsx 中使用 tabIndex?

[英]How to use tabIndex with jsx?

According to the react docs, this should work.根据反应文档,这应该有效。

<div tabIndex="0"></div>

But when I try this, it doesn't work and my input is actually being skipped now!但是当我尝试这个时,它不起作用,我的输入现在实际上被跳过了!

What am I doing wrong here?我在这里做错了什么?

<input
tabIndex='0'/>
<input
tabIndex='1'/>
<input
tabIndex='2'/>

You have typed tabIndex twice without the n, it should be:您在没有 n 的情况下输入了两次 tabIndex,它应该是:

<CustomRadio
tabIndex='0'/>
<CustomCheckbox
tabIndex='1'/>
<input
tabIndex='2'/>

I think you may also need to pass these props into your components, to the underlying element我认为您可能还需要将这些道具传递到您的组件中,传递给底层元素

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM