Skip to content

Commit

Permalink
Add option to give input element an 'aria-labelledby' attribute with …
Browse files Browse the repository at this point in the history
…the value of the parent div's 'input-labeled-by' attribute. For WCAG compliance.
  • Loading branch information
Leslie Baker committed Oct 9, 2014
1 parent 2b3b2d6 commit a3180c3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/fileuploader.js
Expand Up @@ -333,7 +333,8 @@ qq.FileUploaderBasic.prototype = {
acceptFiles: this._options.acceptFiles,
onChange: function(input){
self._onInputChange(input);
}
},
inputLabeledBy: $(this._options.element).attr('input-labeled-by')

This comment has been minimized.

Copy link
@arruda

arruda Apr 10, 2015

Hey there, I think it would be better to use another method of getting the element, since in the README it says this lib doesn't require jQuery =)

This comment has been minimized.

Copy link
@ebrentnelson

ebrentnelson Apr 13, 2015

You are very correct. Probably should change to:

inputLabeledBy: element.getAttribute('input-labeled-by')

@arruda Are you able to verify this change?

This comment has been minimized.

Copy link
@arruda

arruda Apr 14, 2015

yeap, with this change it worked =)

This comment has been minimized.

Copy link
@ebrentnelson

ebrentnelson Apr 14, 2015

@arruda If you want to submit a merge request I will get it into mainline.

});

this.addDisposer(function() { button.dispose(); });
Expand Down Expand Up @@ -938,6 +939,10 @@ qq.UploadButton.prototype = {
input.setAttribute("type", "file");
input.setAttribute("name", this._options.name);

if (this._options["inputLabeledBy"]) {
input.setAttribute("aria-labelledby", this._options["inputLabeledBy"]);
}

qq.css(input, {
position: 'absolute',
// in Opera only 'browse' button
Expand Down

1 comment on commit a3180c3

@ManojUp7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uploading free-hd-desktop-wallpaper-503182519 - Copy.jpg . . .
Uploading free-hd-desktop-wallpaper-503182519.jpg . . .

Please sign in to comment.