26f8822d5c
1/ Set the aria-labelledby attribute on the contenteditable div (find the label from original textarea) 2/ Store/restore the selection for the contenteditable div when it is focused. This allows you to select some text, then go to the toolbar and click a button, and the selection will be restored before the button effect is applied. 3/ Add an accessibility helper plugin. From testing in all screenreaders, I found that all of their support for contenteditable is not great. They treat it like a textbox - which means you can type and edit text, but it tells you nothing about the styles, links or images in the editor. So I added a button to the toolbar, that is only accessible when navigating via keyboard, that opens an accesssibility helper dialogue. The dialogue shows the list of current styles, a global list of all links, and a global list of all images. Choosing an image or link from here, will focus on the editable region, and select the link/image. 4/ Add an accessibility checker plugin to Atto. Checks for images with no alt, images and links with filenames as alternate text/link text, and contrast ratios less than WCAG 2.0 AA.
41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
// This file is part of Moodle - http://moodle.org/
|
|
//
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
/**
|
|
* Atto text editor integration version file.
|
|
*
|
|
* @package atto_accessibilitychecker
|
|
* @copyright 2014 Damyon Wiese <damyon@moodle.com>
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
|
|
defined('MOODLE_INTERNAL') || die();
|
|
|
|
/**
|
|
* Initialise this plugin
|
|
* @param string $elementid
|
|
*/
|
|
function atto_accessibilitychecker_strings_for_js() {
|
|
global $PAGE;
|
|
|
|
$PAGE->requires->strings_for_js(array('nowarnings',
|
|
'report',
|
|
'imagesmissingalt',
|
|
'needsmorecontrast'),
|
|
'atto_accessibilitychecker');
|
|
}
|
|
|