Commit ad6b929a authored by Aaron Wells's avatar Aaron Wells Committed by Gerrit Code Review
Browse files

Merge "bug#1605067: improve accessibility by adding text placeholders for:"

parents 3a1cb563 d48226c7
......@@ -618,8 +618,8 @@ else {
'type' => 'text',
'defaultvalue' => $query,
'hiddenlabel' => true,
'value' => get_string('search'),
'class' => 'emptyonfocus',
'value' => '',
'placeholder' => get_string('search'),
'title' => get_string('search'),
),
'submit' => array(
......
......@@ -439,20 +439,12 @@ function basename(path) {
// Autofocus the first element with a class of 'autofocus' on page load (@todo: move this to pieforms.js)
// Also, connect input elements with the 'emptyonfocus' class to work properly
addLoadEvent(function() {
var element = getFirstElementByTagAndClassName(null, 'autofocus', document.body);
if ( element && typeof(element.focus) == 'function' ) {
element.focus();
}
forEach(getElementsByTagAndClassName('input', 'emptyonfocus'), function(elem) {
elem.emptyonfocusSignal = connect(elem, 'onfocus', function(e) { elem.value = ''; e.stop(); if (elem.emptyonfocusSignal) { disconnect(elem.emptyonfocusSignal); } if (elem.emptyonfocusSignalForm) { disconnect(elem.emptyonfocusSignalForm); } });
if (elem.form) {
elem.emptyonfocusSignalForm = connect(elem.form, 'onsubmit', function(e) { elem.value = ''; if (elem.emptyonfocusSignal) { disconnect(elem.emptyonfocusSignal); } if (elem.emptyonfocusSignalForm) { disconnect(elem.emptyonfocusSignalForm); } });
}
});
});
// Contextual Help
......
......@@ -134,9 +134,9 @@ class PluginSearchElasticsearch extends PluginSearch {
'elements' => array(
'query' => array(
'type' => 'text',
'defaultvalue' => get_string('pagetitle', 'search.elasticsearch'),
'defaultvalue' => '',
'title' => get_string('pagetitle', 'search.elasticsearch'),
'class' => 'emptyonfocus',
'placeholder' => get_string('pagetitle', 'search.elasticsearch'),
'hiddenlabel' => true,
),
'submit' => array(
......
......@@ -237,9 +237,9 @@ abstract class PluginSearch extends Plugin implements IPluginSearch {
'elements' => array(
'query' => array(
'type' => 'text',
'defaultvalue' => get_string('searchusers'),
'defaultvalue' => '',
'title' => get_string('searchusers'),
'class' => 'emptyonfocus',
'placeholder' => get_string('searchusers'),
'hiddenlabel' => true,
),
'submit' => array(
......
......@@ -70,6 +70,7 @@ $searchform['elements']['inputgroup']['elements']['query'] = array(
'title' => get_string('search'),
'hiddenlabel' => true,
'defaultvalue' => $query,
'placeholder' => get_string('searchusers'),
);
$searchform['elements']['inputgroup']['elements']['submit'] = array(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment