]> git.joonet.de Git - adminer.git/commitdiff
Add accessibility labels to Indexes
authorJakub Vrana <jakub@vrana.cz>
Mon, 23 Jan 2017 22:29:00 +0000 (14:29 -0800)
committerJakub Vrana <jakub@vrana.cz>
Mon, 23 Jan 2017 22:29:00 +0000 (14:29 -0800)
adminer/include/functions.inc.php
adminer/indexes.inc.php

index 8913de357b6a272bd1620694205433c2dd2b8e88..68be3a0b0c8895501eeb294bba885a19c52c2b5f 100644 (file)
@@ -112,7 +112,7 @@ function nl_br($string) {
 * @param string
 * @param string
 * @param string
-* @return string
+* @param string
 * @return string
 */
 function checkbox($name, $value, $checked, $label = "", $onclick = "", $class = "", $labelled_by = "") {
@@ -154,11 +154,15 @@ function optionlist($options, $selected = null, $use_keys = false) {
 * @param array
 * @param string
 * @param string true for no onchange, false for radio
+* @param string
 * @return string
 */
-function html_select($name, $options, $value = "", $onchange = true) {
+function html_select($name, $options, $value = "", $onchange = true, $labelled_by = "") {
        if ($onchange) {
-               return "<select name='" . h($name) . "'" . (is_string($onchange) ? ' onchange="' . h($onchange) . '"' : "") . ">" . optionlist($options, $value) . "</select>";
+               return "<select name='" . h($name) . "'"
+                       . (is_string($onchange) ? ' onchange="' . h($onchange) . '"' : "")
+                       . ($labelled_by ? " aria-labelledby='$labelled_by'" : "")
+                       . ">" . optionlist($options, $value) . "</select>";
        }
        $return = "";
        foreach ($options as $key => $val) {
index c6c2950b6cb08cd6e94fe3e2a16fcf7066feed7f..ca69d5dd9b6a479aa127136b569efe883a8c9841 100644 (file)
@@ -93,9 +93,9 @@ if (!$row) {
 <form action="" method="post">
 <table cellspacing="0" class="nowrap">
 <thead><tr>
-<th><?php echo lang('Index Type'); ?>
+<th id="label-type"><?php echo lang('Index Type'); ?>
 <th><input type="submit" class="wayoff"><?php echo lang('Column (length)'); ?>
-<th><?php echo lang('Name'); ?>
+<th id="label-name"><?php echo lang('Name'); ?>
 <th><noscript><input type='image' class='icon' name='add[0]' src='../adminer/static/plus.gif' alt='+' title='<?php echo lang('Add next'); ?>'></noscript>&nbsp;
 </thead>
 <?php
@@ -110,24 +110,24 @@ if ($primary) {
 $j = 1;
 foreach ($row["indexes"] as $index) {
        if (!$_POST["drop_col"] || $j != key($_POST["drop_col"])) {
-               echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow(this);" : 1));
+               echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow(this);" : 1), "label-type");
 
                echo "<td>";
                ksort($index["columns"]);
                $i = 1;
                foreach ($index["columns"] as $key => $column) {
                        echo "<span>" . select_input(
-                               " name='indexes[$j][columns][$i]' onchange=\"" . ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . "(this, '" . h(js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_")) . "');\"",
+                               " name='indexes[$j][columns][$i]' onchange=\"" . ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . "(this, '" . h(js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_")) . "');\" title='" . lang('Column') . "'",
                                ($fields ? array_combine($fields, $fields) : $fields),
                                $column
                        );
-                       echo ($jush == "sql" || $jush == "mssql" ? "<input type='number' name='indexes[$j][lengths][$i]' class='size' value='" . h($index["lengths"][$key]) . "'>" : "");
+                       echo ($jush == "sql" || $jush == "mssql" ? "<input type='number' name='indexes[$j][lengths][$i]' class='size' value='" . h($index["lengths"][$key]) . "' title='" . lang('Length') . "'>" : "");
                        echo ($jush != "sql" ? checkbox("indexes[$j][descs][$i]", 1, $index["descs"][$key], lang('descending')) : "");
                        echo " </span>";
                        $i++;
                }
 
-               echo "<td><input name='indexes[$j][name]' value='" . h($index["name"]) . "' autocapitalize='off'>\n";
+               echo "<td><input name='indexes[$j][name]' value='" . h($index["name"]) . "' autocapitalize='off' aria-labelledby='label-name'>\n";
                echo "<td><input type='image' class='icon' name='drop_col[$j]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick=\"return !editingRemoveRow(this, 'indexes\$1[type]');\">\n";
        }
        $j++;