Does adding 'readonly' attribute to jquery

2019-08-08 03:49发布

I'm using the jquery UI datepicker control but do not want the 'keyboard' to display on mobile/tablet when a user clicks on the input field.

A way to prevent this is to add 'readyonly=readonly' to the input.

However, I'm concerned that this will negatively affect accessibility.

Will users, using a screen reader, still be able to edit the field / select a date.

https://jqueryui.com/datepicker/

1条回答
姐就是有狂的资本
2楼-- · 2019-08-08 04:19

The short answer is yes, it will be very difficult for visually impaired users to select a date.

In terms of screen readers, the experience will not too different if they are using NVDA and WindowEyes. Because these screen readers don't announce whether a text input is read-only or not. However, JAWS does announce if a field is read only. So it's a mixed bag and may cause confusion for some users.

But, more importantly, you should be aware that many blind users rely on keyboard to enter dates; picking a date from a table is a tedious task for them. So, disabling the keyboard may not be an ideal solution.

In my opinion it is best use a date picker icon instead of relying on the focus event. This way, sighted users can click on the icon to display the picker without ever displaying the keyboard.

查看更多
登录 后发表回答