MDL-27429 Adding tabindex and on keypress to the blocks show/hide icon.
This commit is contained in:
@@ -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('<img class="block-hider-hide" alt="'+config.tooltipVisible+'" title="'+config.tooltipVisible+'" />');
|
||||
var hide = Y.Node.create('<img class="block-hider-hide" tabindex="0" alt="'+config.tooltipVisible+'" title="'+config.tooltipVisible+'" />');
|
||||
hide.setAttribute('src', this.get('iconVisible')).on('click', this.updateState, this, true);
|
||||
var show = Y.Node.create('<img class="block-hider-show" alt="'+config.tooltipHidden+'" title="'+config.tooltipHidden+'" />');
|
||||
hide.on('keypress', this.updateStateKey, this, true);
|
||||
var show = Y.Node.create('<img class="block-hider-show" tabindex="0" alt="'+config.tooltipHidden+'" title="'+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, {
|
||||
|
||||
Reference in New Issue
Block a user