MDL-32946 - Blocks - Improving image alts for accessibility.
This commit is contained in:
+4
-2
@@ -836,7 +836,8 @@ M.core_dock.genericblock.prototype = {
|
||||
}
|
||||
|
||||
// Must set the image src seperatly of we get an error with XML strict headers
|
||||
var moveto = Y.Node.create('<input type="image" class="moveto customcommand requiresjs" alt="'+M.str.block.addtodock+'" title="'+M.str.block.addtodock+'" />');
|
||||
var moveto = Y.Node.create('<input type="image" class="moveto customcommand requiresjs" title="'+M.str.block.addtodock+'" alt="'+
|
||||
Y.Escape.html(M.util.get_string('dockblock', 'block', node.one('.header .title h2').getHTML())) +'" />');
|
||||
var icon = 't/block_to_dock';
|
||||
if (right_to_left()) {
|
||||
icon = 't/block_to_dock_rtl';
|
||||
@@ -906,7 +907,8 @@ M.core_dock.genericblock.prototype = {
|
||||
}
|
||||
|
||||
// Must set the image src seperatly of we get an error with XML strict headers
|
||||
var movetoimg = Y.Node.create('<img alt="'+M.str.block.undockitem+'" title="'+M.util.get_string('undockblock', 'block', blocktitle.innerHTML)+'" />');
|
||||
var movetoimg = Y.Node.create('<img alt="'+Y.Escape.html(M.str.block.undockitem)+'" title="'+
|
||||
Y.Escape.html(M.util.get_string('undockblock', 'block', blocktitle.innerHTML)) +'" />');
|
||||
var icon = 't/dock_to_block';
|
||||
if (right_to_left()) {
|
||||
icon = 't/dock_to_block_rtl';
|
||||
|
||||
@@ -59,6 +59,12 @@ class block_base {
|
||||
*/
|
||||
var $title = NULL;
|
||||
|
||||
/**
|
||||
* The name of the block to be displayed in the block title area if the title is empty.
|
||||
* @var string arialabel
|
||||
*/
|
||||
var $arialabel = NULL;
|
||||
|
||||
/**
|
||||
* The type of content that this block creates. Currently support options - BLOCK_TYPE_LIST, BLOCK_TYPE_TEXT
|
||||
* @var int $content_type
|
||||
@@ -240,8 +246,10 @@ class block_base {
|
||||
if (!$this->hide_header()) {
|
||||
$bc->title = $this->title;
|
||||
}
|
||||
|
||||
if (empty($bc->title)) {
|
||||
$bc->arialabel = new lang_string('pluginname', get_class($this));
|
||||
$this->arialabel = $bc->arialabel;
|
||||
}
|
||||
|
||||
if ($this->page->user_is_editing()) {
|
||||
|
||||
@@ -43,6 +43,7 @@ $string['deletecheck'] = 'Delete {$a} block?';
|
||||
$string['deleteblock'] = 'Delete {$a} block';
|
||||
$string['deleteblockcheck'] = 'Are you sure that you want to delete this block titled {$a}?';
|
||||
$string['deleteblockwarning'] = '<p>You are about to delete a block that appears elsewhere.</p><p>Original block location: {$a->location}<br />Display on page types: {$a->pagetype}</p><p>Are you sure you want to continue?</p>';
|
||||
$string['dockblock'] = 'Dock {$a} block';
|
||||
$string['hideblock'] = 'Hide {$a} block';
|
||||
$string['hidedockpanel'] = 'Hide the dock panel';
|
||||
$string['hidepanel'] = 'Hide panel';
|
||||
|
||||
+10
-6
@@ -1025,25 +1025,29 @@ class block_manager {
|
||||
|
||||
$controls = array();
|
||||
$actionurl = $this->page->url->out(false, array('sesskey'=> sesskey()));
|
||||
$blocktitle = $block->title;
|
||||
if (empty($blocktitle)) {
|
||||
$blocktitle = $block->arialabel;
|
||||
}
|
||||
|
||||
if ($this->page->user_can_edit_blocks()) {
|
||||
// Move icon.
|
||||
$controls[] = array('url' => $actionurl . '&bui_moveid=' . $block->instance->id,
|
||||
'icon' => 't/move', 'caption' => get_string('moveblock', 'block', $block->title),
|
||||
'icon' => 't/move', 'caption' => get_string('moveblock', 'block', $blocktitle),
|
||||
'class' => 'editing_move');
|
||||
}
|
||||
|
||||
if ($this->page->user_can_edit_blocks() || $block->user_can_edit()) {
|
||||
// Edit config icon - always show - needed for positioning UI.
|
||||
$controls[] = array('url' => $actionurl . '&bui_editid=' . $block->instance->id,
|
||||
'icon' => 't/edit', 'caption' => get_string('configureblock', 'block', $block->title),
|
||||
'icon' => 't/edit', 'caption' => get_string('configureblock', 'block', $blocktitle),
|
||||
'class' => 'editing_edit');
|
||||
}
|
||||
|
||||
if ($this->user_can_delete_block($block)) {
|
||||
// Delete icon.
|
||||
$controls[] = array('url' => $actionurl . '&bui_deleteid=' . $block->instance->id,
|
||||
'icon' => 't/delete', 'caption' => get_string('deleteblock', 'block', $block->title),
|
||||
'icon' => 't/delete', 'caption' => get_string('deleteblock', 'block', $blocktitle),
|
||||
'class' => 'editing_delete');
|
||||
}
|
||||
|
||||
@@ -1051,11 +1055,11 @@ class block_manager {
|
||||
// Show/hide icon.
|
||||
if ($block->instance->visible) {
|
||||
$controls[] = array('url' => $actionurl . '&bui_hideid=' . $block->instance->id,
|
||||
'icon' => 't/hide', 'caption' => get_string('hideblock', 'block', $block->title),
|
||||
'icon' => 't/hide', 'caption' => get_string('hideblock', 'block', $blocktitle),
|
||||
'class' => 'editing_hide');
|
||||
} else {
|
||||
$controls[] = array('url' => $actionurl . '&bui_showid=' . $block->instance->id,
|
||||
'icon' => 't/show', 'caption' => get_string('showblock', 'block', $block->title),
|
||||
'icon' => 't/show', 'caption' => get_string('showblock', 'block', $blocktitle),
|
||||
'class' => 'editing_show');
|
||||
}
|
||||
}
|
||||
@@ -1070,7 +1074,7 @@ class block_manager {
|
||||
|
||||
$controls[] = array('url' => $CFG->wwwroot . '/' . $CFG->admin .
|
||||
'/roles/assign.php?contextid=' . $block->context->id . '&returnurl=' . urlencode($return),
|
||||
'icon' => 't/assignroles', 'caption' => get_string('assignrolesinblock', 'block', $block->title),
|
||||
'icon' => 't/assignroles', 'caption' => get_string('assignrolesinblock', 'block', $blocktitle),
|
||||
'class' => 'editing_roles');
|
||||
}
|
||||
|
||||
|
||||
@@ -676,8 +676,11 @@ class page_requirements_manager {
|
||||
case 'core_dock':
|
||||
$module = array('name' => 'core_dock',
|
||||
'fullpath' => '/blocks/dock.js',
|
||||
'requires' => array('base', 'node', 'event-custom', 'event-mouseenter', 'event-resize'),
|
||||
'strings' => array(array('addtodock', 'block'),array('undockitem', 'block'),array('undockblock', 'block'),array('undockall', 'block'),array('thisdirectionvertical', 'langconfig'),array('hidedockpanel', 'block'),array('hidepanel', 'block')));
|
||||
'requires' => array('base', 'node', 'event-custom', 'event-mouseenter', 'event-resize', 'escape'),
|
||||
'strings' => array(array('addtodock', 'block'),array('undockitem', 'block'),array('dockblock', 'block'),
|
||||
array('undockblock', 'block'),array('undockall', 'block'),array('thisdirectionvertical', 'langconfig'),
|
||||
array('hidedockpanel', 'block'),array('hidepanel', 'block')
|
||||
));
|
||||
break;
|
||||
case 'core_message':
|
||||
$module = array('name' => 'core_message',
|
||||
|
||||
Reference in New Issue
Block a user