Created
July 2, 2014 16:45
-
-
Save itsDanOades/103b38e42fcb4cb1bc46 to your computer and use it in GitHub Desktop.
Using ExternalInterface to send screen reader alerts
This file contains 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
ActionScript: | |
import flash.external.*; | |
public class MyButton extends Sprite() | |
{ | |
//Override the visible property to inform the screen reader when this object becomes visible | |
override public function set visible(value : Boolean) : void | |
{ | |
super.visible = value; | |
if(visible) | |
{ | |
if(ExternalInterface.available) | |
{ | |
ExternalInterface.call(‘SendScreenReaderAlert’, “My Button is now visible”); | |
} | |
} | |
} | |
} | |
JavaScript: | |
//Create a hidden aria alert | |
function SendScreenReaderAlert(message) { | |
$("<div role='alert' style='width: 1px; position: absolute; left: -2500px; overflow: hidden;'><p>" + message + "</p></div>) | |
.appendTo($('body')); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment