Last active
August 29, 2015 14:06
-
-
Save jonlow/13c0aabc84f511b47afa to your computer and use it in GitHub Desktop.
Show completed text for screen readers on explore pages. When a an explore button is clicked, this appends some text to the explore button. The text should instruct screen reader users that they have already interacted with the button/popup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$(document).ready(function () { | |
T2.CreateButton.prototype.run = (function(_super) { | |
return function() { | |
// This adds some visually hidden text for screen readers. | |
// Change the text so it makes sense in context with your explore page | |
if(!this.completed) | |
this.elements.link[0].innerHTML += ' <span class="visuallyhidden">completed</span>'; | |
return _super.apply(this); | |
}; | |
})(T2.CreateButton.prototype.run); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the function has an argument, then you need to pass it to apply() in an array: