简体   繁体   English

如果禁用了HTML中的元素,如何制表符

[英]How to tab through a element in HTML, if it is disabled

I am working on a project to make a site accessible for blind users. 我正在做一个使盲人用户访问网站的项目。 I have a input box which is disabled by default and act as a label. 我有一个输入框,默认情况下处于禁用状态,并充当标签。 But I am not able to access that using TAB key while tabbing through the site. 但是在浏览该站点时,无法使用TAB键访问该键。

I have tried:- 我努力了:-

tabindex="0"

which will make that element accessible using keyboard(Tab key). 这将使您可以使用键盘(Tab键)访问该元素。

I know that if the input box contains 我知道如果输入框包含

disabled="true"

then 然后

tabindex="0"

But that doesn't work either. 但这也不起作用。

Is there any other way to make it accessible using keyboard only, so that the screen reader will read the data inside the disabled input box for the blind user? 还有其他方法可以使仅使用键盘访问它,以便屏幕阅读器为盲人用户读取禁用的输入框中的数据吗?

How about use readonly instead of disabled ? 如何使用readonly而不是disabled That will still allow the <input> to be in the tab order but the user can't modify it. 这样仍然允许<input>处于制表符顺序,但用户无法修改它。 A screen reader will read the contents of the <input> field and will additionally say "read only". 屏幕阅读器将读取<input>字段的内容,并另外显示“只读”。

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

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