Skip to content

Commit

Permalink
MDL-28235 form: Help button popup close accessibility improved
Browse files Browse the repository at this point in the history
AMOS BEGIN
 CPY [close,editor],[close,form]
AMOS END
  • Loading branch information
Frederic Massart committed Oct 2, 2012
1 parent 9273bd1 commit bbb553e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions lang/en/form.php
Expand Up @@ -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.';
Expand Down
8 changes: 6 additions & 2 deletions lib/javascript-static.js
Expand Up @@ -1385,16 +1385,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('<a id="closehelpbox" href="#"><img src="'+M.util.image_url('t/delete', 'moodle')+'" /></a>');
var strclose = Y.Escape.html(M.str.form.close);
var closebtn = Y.Node.create('<a id="closehelpbox" href="#"><img src="'+M.util.image_url('t/delete', 'moodle')+'" alt="'+strclose+'" /></a>');
var footerbtn = Y.Node.create('<button class="closebtn">'+strclose+'</button>');
// Create an overlay from markup
this.overlay = new Y.Overlay({
headerContent: closebtn,
footerContent: footerbtn,
bodyContent: '',
id: 'helppopupbox',
width:'400px',
Expand All @@ -1404,6 +1407,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");

Expand Down
2 changes: 2 additions & 0 deletions lib/outputrenderers.php
Expand Up @@ -1733,6 +1733,7 @@ protected function render_old_help_icon(old_help_icon $helpicon) {
$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'));
Expand Down Expand Up @@ -1798,6 +1799,7 @@ protected function render_help_icon(help_icon $helpicon) {
$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'));
Expand Down
2 changes: 2 additions & 0 deletions theme/base/style/core.css
Expand Up @@ -477,6 +477,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;}

Expand Down

0 comments on commit bbb553e

Please sign in to comment.