MDL-42752 File-picker: Fix tabbing to disabled icons

This commit is contained in:
Jason Fowler 2014-07-04 14:08:16 +08:00
parent 7a4832ecb9
commit a34f0a4331
2 changed files with 10 additions and 6 deletions

View File

@ -602,13 +602,13 @@ class core_files_renderer extends plugin_renderer_base {
<div class="fp-tb-message"></div>
</div>
<div class="fp-viewbar">
<a title="'. get_string('displayicons', 'repository') .'" class="fp-vb-icons" href="#">
<a role="button" title="'. get_string('displayicons', 'repository') .'" class="fp-vb-icons" href="#">
<img alt="" src="'. $this->pix_url('fp/view_icon_active', 'theme') .'" />
</a>
<a title="'. get_string('displaydetails', 'repository') .'" class="fp-vb-details" href="#">
<a role="button" title="'. get_string('displaydetails', 'repository') .'" class="fp-vb-details" href="#">
<img alt="" src="'. $this->pix_url('fp/view_list_active', 'theme') .'" />
</a>
<a title="'. get_string('displaytree', 'repository') .'" class="fp-vb-tree" href="#">
<a role="button" title="'. get_string('displaytree', 'repository') .'" class="fp-vb-tree" href="#">
<img alt="" src="'. $this->pix_url('fp/view_tree_active', 'theme') .'" />
</a>
</div>

View File

@ -1266,12 +1266,16 @@ M.core_filepicker.init = function(Y, options) {
var viewbar = this.fpnode.one('.fp-viewbar')
if (viewbar) {
if (mode) {
viewbar.addClass('enabled').removeClass('disabled')
viewbar.addClass('enabled').removeClass('disabled');
this.fpnode.all('.fp-vb-icons,.fp-vb-tree,.fp-vb-details').setAttribute("aria-disabled", "false");
this.fpnode.all('.fp-vb-icons,.fp-vb-tree,.fp-vb-details').setAttribute("tabindex", "");
} else {
viewbar.removeClass('enabled').addClass('disabled')
viewbar.removeClass('enabled').addClass('disabled');
this.fpnode.all('.fp-vb-icons,.fp-vb-tree,.fp-vb-details').setAttribute("aria-disabled", "true");
this.fpnode.all('.fp-vb-icons,.fp-vb-tree,.fp-vb-details').setAttribute("tabindex", "-1");
}
}
this.fpnode.all('.fp-vb-icons,.fp-vb-tree,.fp-vb-details').removeClass('checked')
this.fpnode.all('.fp-vb-icons,.fp-vb-tree,.fp-vb-details').removeClass('checked');
var modes = {1:'icons', 2:'tree', 3:'details'};
this.fpnode.all('.fp-vb-'+modes[this.viewmode]).addClass('checked');
},