Skip to content
Advertisement

How to add wai-aria property for file picker?

I am currently following this tutorial to have a file picker functionality. http://www.alecjacobson.com/weblog/?p=1645

I would like to add wai-aria attribute for “choose file” part to make it readable. I have tried to use aria-controls and tabindex but couldnt get any positive response when i simulate some validators.. Any idea?

JavaScript

Advertisement

Answer

Modern browsers identify the file type of input control as one of several different “types” (Label, Input, or a Generic Object) with a button as a pseudo-element attached. But for accessibility purposes I think it is safe to identify it as a button to screen readers as that is interactively how it is used.

So, I would add the following WAI-ARIA attributes to your file type of input controls:

JavaScript

If your screen reader community gets confused by that then “role=textbox” would be my second option.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement