Issue
I noticed on a few places (mainly Youtube's comments), there are "textbox" instead of the normal "textarea".
<div role="textbox" aria-multiline="true"></div>
vs <textarea></textarea>
Also I see <div role="textbox"></div>
instead of <input type="text">
Is there any functionality advantages to use role="textbox"
instead of textarea
or input
? Or is this just pure preference? For example, is it easier to modify or edit using Javascript?
As you see above, I am selecting the comment box with Chrome's inspector.
Now I added text to the comment box, and the text appears inside the div element stated above when viewing Chrome's inspector.
Solution
I'm not sure where you are seeing that a div should be a textbox, but that's incorrect. The tag is input, not div.
But, to your larger question the role attribute pertains to the WAI-ARIA standard, which relates to user accessibility for those who use assistive technologies, such as screen readers. It allows those users to navigate a page more easily because the screen reader has a better idea of what elements are what on the page.
There are no new functions that the text field takes on because of the use of this attribute. ARIA is about accessibility.
You can read a bit more about this, particularly relating to text fields at: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_textbox_role
Answered By - Scott Marcus
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.