如題。form 本身就能說明這是個表單了,那么 role="form" 加了有什么作用呢?
ringa_lee
The role attribute is used by screen reading software
You can learn about ARIA, and then you will understand what these roles are used for
The attribute role exists to tell Accessibility applications (such as screen reading programs, convenient programs for blind people to access the Internet) that this is a button. In the HTML5 element, the tag itself has semantics, so there is no need to add role, at least it is not recommended. However, many bootstrap cases have similar attributes and declarations in order to be compatible with older versions of browsers. (User Agent), if your code uses html5 tags and is not prepared to support older versions of browsers, you might as well not use the role tag.
https://segmentfault.com/a/11...