【问题标题】:How to use tabIndex with jsx?如何在 jsx 中使用 tabIndex?
【发布时间】:2020-05-31 22:10:46
【问题描述】:

根据反应文档,这应该可以工作。

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

但是当我尝试这个时,它不起作用 我的输入实际上现在被跳过了!

我在这里做错了什么?

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

【问题讨论】:

  • 您需要使用正确的拼写,您对 tabIndex 使用了错误的拼写。它应该是 tabIndex 而不是 tabIndex
  • 抱歉,我的真实代码中的拼写是正确的。

标签: javascript html reactjs jsx tabindex


【解决方案1】:

你已经输入了两次没有 n 的 tabIndex,它应该是:

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

我认为您可能还需要将这些道具传递到您的组件中,传递给底层元素

【讨论】:

    猜你喜欢
    • 2021-07-10
    • 2015-04-08
    • 1970-01-01
    • 2018-07-04
    • 2018-07-06
    • 1970-01-01
    • 2021-06-15
    • 2019-10-15
    • 1970-01-01
    相关资源
    最近更新 更多