Skip to content

Commit

Permalink
Revert "MDL-30912 - lib - A tidy up of the submit url jump functions …
Browse files Browse the repository at this point in the history
…for greater ease with accessability."

This reverts commit 82203a1.
  • Loading branch information
stronk7 committed Jul 5, 2012
1 parent 8049a5c commit 2173e56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
27 changes: 12 additions & 15 deletions lib/javascript-static.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -381,36 +381,33 @@ M.util.init_select_autosubmit = function(Y, formid, selectid, nothing) {
if ((nothing===false || select.get('value') != nothing) && paramobject.lastindex != select.get('selectedIndex')) { if ((nothing===false || select.get('value') != nothing) && paramobject.lastindex != select.get('selectedIndex')) {
//prevent event bubbling and detach handlers to prevent multiple submissions caused by double clicking //prevent event bubbling and detach handlers to prevent multiple submissions caused by double clicking
e.halt(); e.halt();
paramobject.eventkeypress.detach();
paramobject.eventblur.detach();
paramobject.eventchangeorblur.detach(); paramobject.eventchangeorblur.detach();

this.submit(); this.submit();
} }
}; };

// Attach the change event to the keypress, blur, and click actions.
var changedown = function(e, paramobject) {
if ((nothing===false || select.get('value') != nothing) && paramobject.lastindex != select.get('selectedIndex')) {
if(e.keyCode == 13) {
form.submit();
}
}
}

// Attach the change event to the keydown and click actions.
// We don't use the change event because IE fires it on every arrow up/down // We don't use the change event because IE fires it on every arrow up/down
// event.... usability // event.... usability
var paramobject = new Object(); var paramobject = new Object();
paramobject.lastindex = select.get('selectedIndex'); paramobject.lastindex = select.get('selectedIndex');
paramobject.eventchangeorblur = select.on('click', processchange, form, paramobject); paramobject.eventkeypress = Y.on('key', processchange, select, 'press:13', form, paramobject);
paramobject.eventkeypress = Y.on('keydown', changedown, select, '', form, paramobject); paramobject.eventblur = select.on('blur', processchange, form, paramobject);
//little hack for chrome that need onChange event instead of onClick - see MDL-23224
if (Y.UA.webkit) {
paramobject.eventchangeorblur = select.on('change', processchange, form, paramobject);
} else {
paramobject.eventchangeorblur = select.on('click', processchange, form, paramobject);
}
} }
} }
}); });
}; };


/** /**
* Attach handler to url_select * Attach handler to url_select
* Deprecated from 2.3 onwards.
* Please use @see init_select_autosubmit() for redirecting to a url (above).
* This function has accessability issues and also does not use the formid passed through as a parameter.
*/ */
M.util.init_url_select = function(Y, formid, selectid, nothing) { M.util.init_url_select = function(Y, formid, selectid, nothing) {
YUI(M.yui.loader).use('node', function(Y) { YUI(M.yui.loader).use('node', function(Y) {
Expand Down
2 changes: 1 addition & 1 deletion lib/outputrenderers.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ protected function render_url_select(url_select $select) {
$go = html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('go'))); $go = html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('go')));
$output .= html_writer::tag('noscript', html_writer::tag('div', $go), array('style'=>'inline')); $output .= html_writer::tag('noscript', html_writer::tag('div', $go), array('style'=>'inline'));
$nothing = empty($select->nothing) ? false : key($select->nothing); $nothing = empty($select->nothing) ? false : key($select->nothing);
$output .= $this->page->requires->js_init_call('M.util.init_select_autosubmit', array($select->formid, $select->attributes['id'], $nothing)); $output .= $this->page->requires->js_init_call('M.util.init_url_select', array($select->formid, $select->attributes['id'], $nothing));
} else { } else {
$output .= html_writer::empty_tag('input', array('type'=>'submit', 'value'=>$select->showbutton)); $output .= html_writer::empty_tag('input', array('type'=>'submit', 'value'=>$select->showbutton));
} }
Expand Down

0 comments on commit 2173e56

Please sign in to comment.