From 5a062fcd8f867c753a46a7b67c1de478311b04fd Mon Sep 17 00:00:00 2001 From: John Beedell Date: Mon, 27 Jun 2011 16:19:47 +0100 Subject: [PATCH] MDL-27429 Adding tabindex and on keypress to the blocks show/hide icon. --- lib/javascript-static.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/javascript-static.js b/lib/javascript-static.js index 5e06bc27f9d..ae098c234f1 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -617,10 +617,12 @@ M.util.init_block_hider = function(Y, config) { t = b.one('.title'), a = null; if (t && (a = t.one('.block_action'))) { - var hide = Y.Node.create(''+config.tooltipVisible+''); + var hide = Y.Node.create(''+config.tooltipVisible+''); hide.setAttribute('src', this.get('iconVisible')).on('click', this.updateState, this, true); - var show = Y.Node.create(''+config.tooltipHidden+''); + hide.on('keypress', this.updateStateKey, this, true); + var show = Y.Node.create(''+config.tooltipHidden+''); show.setAttribute('src', this.get('iconHidden')).on('click', this.updateState, this, false); + show.on('keypress', this.updateStateKey, this, false); a.insert(show, 0).insert(hide, 0); } }, @@ -631,6 +633,11 @@ M.util.init_block_hider = function(Y, config) { } else { this.get('block').removeClass('hidden'); } + }, + updateStateKey : function(e, hide) { + if (e.keyCode == 13) { //allow hide/show via enter key + this.updateState(this, hide); + } } }; Y.extend(blockhider, Y.Base, blockhider.prototype, {