user664833 user664833 - 2 months ago 14
HTML Question

How does role=form help accessibility?

I have read that the

role
attribute was added to Bootstrap for accessibility, and I would like to know how
<form role="form">
helps accessibility. See http://getbootstrap.com/css/#forms-example for an example of this specific usage.

I searched Bootstrap's repo for "role" to no avail.

My issue is that the information seems redundant. The notion that the element is a form is already expressed by the HTML tag itself (
<form>
), so what does it help if we also add that the element is playing the
role
of
form
? It would make sense to add
role="..."
if
role
was going to be different than
form
(I don't know what - but let's pretend); as it stands (especially without concrete reasoning / use case examples), it is puzzling at best.

Answer

If you add a role="form" to a form, a screen reader sees it as a region on a webpage. That means that a user can easily jump to the form with his/her region quick navigation keys (for example, in JAWS 15 you use R for this). And also, your user will be able to easily find where the form starts and ends because screen readers mark start and end of regions.

Comments