Fix tooltip accessibility for screen readers
authorDavid Sn <divad.nnamtdeis@gmail.com>
Sat, 16 Dec 2017 01:39:35 +0000 (01:39 +0000)
committerDavid Sn <divad.nnamtdeis@gmail.com>
Sat, 16 Dec 2017 14:43:30 +0000 (15:43 +0100)
By adding an additional aria-label attribute to the tooltip,
we can ensure that every tooltip will be accessible
for accessibility tools like screen readers.

Works with Echo extension, but I am not sure if there
are extensions who are using the original-title attribute.

Tested with ChromeVox on Chrome 62.0.3202.94.

Bug: T54711
Change-Id: I19500c4e8ccbdcb8288b9c2299a29b3f8a31639d

includes/htmlform/fields/HTMLCheckMatrix.php

index dd4e707..df44626 100644 (file)
@@ -106,6 +106,7 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
                                $tooltipAttribs = [
                                        'class' => "mw-htmlform-tooltip $tooltipClass",
                                        'title' => $this->mParams['tooltips'][$rowLabel],
                                $tooltipAttribs = [
                                        'class' => "mw-htmlform-tooltip $tooltipClass",
                                        'title' => $this->mParams['tooltips'][$rowLabel],
+                                       'aria-label' => $this->mParams['tooltips'][$rowLabel]
                                ];
                                $rowLabel .= ' ' . Html::element( 'span', $tooltipAttribs, '' );
                        }
                                ];
                                $rowLabel .= ' ' . Html::element( 'span', $tooltipAttribs, '' );
                        }