1 /**
  2  * @fileOverview http://www.w3.org/TR/wai-aria-practices/#trap_focus
  3  * @author yiminghe@gmail.com
  4  */
  5 KISSY.add("overlay/aria", function (S, Event) {
  6     function Aria() {
  7     }
  8 
  9     Aria.ATTRS =
 10     /**
 11      * @lends Overlay#
 12      */
 13     {
 14         /**
 15          * Whether support aria.
 16          * Focus on show and trap focus in overlay when visible.
 17          * Default: false.
 18          * @type Boolean
 19          */
 20         aria:{
 21             view:1
 22         }
 23     };
 24 
 25     Aria.prototype = {
 26         __bindUI:function () {
 27             var self = this,
 28                 el = self.get("el");
 29             if (self.get("aria")) {
 30                 el.on("keydown", function (e) {
 31                     if (e.keyCode === Event.KeyCodes.ESC) {
 32                         self.hide();
 33                         e.halt();
 34                     }
 35                 });
 36             }
 37         }
 38     };
 39     return Aria;
 40 }, {
 41     requires:['event']
 42 });