Javascript 如何通过键盘选项卡使输入字段不可访问
我有一个可以使用Javascript 如何通过键盘选项卡使输入字段不可访问,javascript,html,reactjs,accessibility,Javascript,Html,Reactjs,Accessibility,我有一个可以使用选项卡键访问的输入字段 <label class="radioButtonCard-label" for="myInput"> <input id="myInput" type="radio" name="radio" /> 更新: 我试着使用jquery在输入字段上设置tabindex=“-1,结果成功了。(想象一下在2020年使
选项卡
键访问的输入字段
<label class="radioButtonCard-label" for="myInput">
<input
id="myInput"
type="radio"
name="radio"
/>
更新:
我试着使用jquery在输入字段上设置tabindex=“-1
,结果成功了。(想象一下在2020年使用jquery)
$('#myInput').attr('tabindex','-1');
我不知道为什么我不能将这个
tabindex
属性直接应用到React中的输入字段。试试tabindex
,注意大写的I。为什么你不能使用disabled
属性?对不起,你能详细说明为什么需要它吗?看起来,你正在试图破坏你产品的可访问性。
Type '{ id: string; type: string; name: string; checked: boolean; tabindex: string; }' is not assignable to type 'DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>'.
Property 'tabindex' does not exist on type 'DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>'.ts(2322)