From 6b8e97b01721b305509042d56d760319bda3c451 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Tue, 2 Oct 2012 14:28:55 +0800 Subject: [PATCH] MDL-28235 form: Help button popup close accessibility improved AMOS BEGIN CPY [close,editor],[close,form] AMOS END --- lang/en/form.php | 1 + lib/javascript-static.js | 8 ++++++-- lib/outputrenderers.php | 2 ++ theme/base/style/core.css | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lang/en/form.php b/lang/en/form.php index fbd8c9d46b5..3cb86a18fc3 100644 --- a/lang/en/form.php +++ b/lang/en/form.php @@ -25,6 +25,7 @@ $string['addfields'] = 'Add {$a} fields to form'; $string['advancedelement'] = 'Advanced element'; +$string['close'] = 'Close'; $string['day'] = 'Day'; $string['display'] = 'Display'; $string['err_alphanumeric'] = 'You must enter only letters or numbers here.'; diff --git a/lib/javascript-static.js b/lib/javascript-static.js index c9d2efd19e6..d5cac64e4fb 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -1304,16 +1304,19 @@ M.util.help_icon = { event.preventDefault(); if (M.util.help_icon.instance === null) { var Y = M.util.help_icon.Y; - Y.use('overlay', 'io-base', 'event-mouseenter', 'node', 'event-key', function(Y) { + Y.use('overlay', 'io-base', 'event-mouseenter', 'node', 'event-key', 'escape', function(Y) { var help_content_overlay = { helplink : null, overlay : null, init : function() { - var closebtn = Y.Node.create(''); + var strclose = Y.Escape.html(M.str.form.close); + var closebtn = Y.Node.create(''+strclose+''); + var footerbtn = Y.Node.create(''); // Create an overlay from markup this.overlay = new Y.Overlay({ headerContent: closebtn, + footerContent: footerbtn, bodyContent: '', id: 'helppopupbox', width:'400px', @@ -1323,6 +1326,7 @@ M.util.help_icon = { this.overlay.render(Y.one(document.body)); closebtn.on('click', this.overlay.hide, this.overlay); + footerbtn.on('click', this.overlay.hide, this.overlay); var boundingBox = this.overlay.get("boundingBox"); diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index f51c5d4aa09..7413d41a8a9 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -1623,6 +1623,7 @@ class core_renderer extends renderer_base { $output = html_writer::tag('a', $output, $attributes); $this->page->requires->js_init_call('M.util.help_icon.add', array(array('id'=>$id, 'url'=>$url->out(false)))); + $this->page->requires->string_for_js('close', 'form'); // and finally span return html_writer::tag('span', $output, array('class' => 'helplink')); @@ -1687,6 +1688,7 @@ class core_renderer extends renderer_base { $output = html_writer::tag('a', $output, $attributes); $this->page->requires->js_init_call('M.util.help_icon.add', array(array('id'=>$id, 'url'=>$url->out(false)))); + $this->page->requires->string_for_js('close', 'form'); // and finally span return html_writer::tag('span', $output, array('class' => 'helplink')); diff --git a/theme/base/style/core.css b/theme/base/style/core.css index 207e8e891a4..7572eb3b64f 100644 --- a/theme/base/style/core.css +++ b/theme/base/style/core.css @@ -569,6 +569,8 @@ body.tag .managelink {padding: 5px;} #helppopupbox {background-color: #eee; border: 1px solid #848484;z-index: 10000 !important;} #helppopupbox .yui3-widget-hd {float:right;margin:3px 3px 0 0;} #helppopupbox .yui3-widget-bd {margin:0 1em 1em 1em;border-top:1px solid #eee;} +#helppopupbox .yui3-widget-ft {text-align: center;} +#helppopupbox .yui3-widget-ft .closebtn {margin:0 1em 1em 1em;} #helppopupbox .helpheading {font-size: 1em;} #helppopupbox .spinner {margin:1em;}