From f2e4da68763ca3db619efc8431c8c1970912a098 Mon Sep 17 00:00:00 2001 From: Rossiani Wijaya Date: Mon, 5 Aug 2013 21:39:38 +0800 Subject: [PATCH] MDL-41033 Filepicker: add ARIA attributes for selecting file in a modal --- lib/outputrequirementslib.php | 2 +- repository/filepicker.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index d7cf4c0c9ba..fa8be04f9ee 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -658,7 +658,7 @@ class page_requirements_manager { array('nofilesavailable', 'repository'), array('norepositoriesavailable', 'repository'), array('fileexistsdialogheader', 'repository'), array('fileexistsdialog_editor', 'repository'), array('fileexistsdialog_filemanager', 'repository'), array('renameto', 'repository'), - array('referencesexist', 'repository') + array('referencesexist', 'repository'), array('edit', 'moodle') )); break; case 'core_comment': diff --git a/repository/filepicker.js b/repository/filepicker.js index 95342c43da3..00a36a3f95c 100644 --- a/repository/filepicker.js +++ b/repository/filepicker.js @@ -1065,7 +1065,9 @@ M.core_filepicker.init = function(Y, options) { }, false); }, select_file: function(args) { + Y.one('#fp-file_label_'+this.options.client_id).setContent(Y.Escape.html(M.str.moodle.edit+' '+args.title)); this.selectui.show(); + Y.one('#'+this.selectnode.get('id')).focus(); var client_id = this.options.client_id; var selectnode = this.selectnode; var return_types = this.options.repositories[this.active_repo.id].return_types; @@ -1306,8 +1308,13 @@ M.core_filepicker.init = function(Y, options) { } // create panel for selecting a file (initially hidden) this.selectnode = Y.Node.createWithFilesSkin(M.core_filepicker.templates.selectlayout). - set('id', 'filepicker-select-'+client_id); + set('id', 'filepicker-select-'+client_id). + set('aria-live', 'assertive'). + set('role', 'dialog'); + + var fplabel = 'fp-file_label_'+ client_id; this.selectui = new Y.Panel({ + headerContent: ''+M.str.moodle.edit+'', srcNode : this.selectnode, zIndex : 7600, centered : true, @@ -1317,6 +1324,7 @@ M.core_filepicker.init = function(Y, options) { }); // allow to move the panel dragging it by it's header: this.selectui.plug(Y.Plugin.Drag,{handles:['#filepicker-select-'+client_id+' .yui3-widget-hd']}); + Y.one('#'+this.selectnode.get('id')).setAttribute('aria-labelledby', fplabel); this.selectui.hide(); // event handler for lazy loading of thumbnails and next page this.fpnode.one('.fp-content').on(['scroll','resize'], this.content_scrolled, this);