Add aural "+" and "-" hints to unified diffs for users who use screenreaders
Summary: See PHI160 for discussion.
Test Plan:
With `?__aural__=1`, saw aural hints:
{F5229986}
Without, saw normal visual diff.
Reviewers: amckinley
Reviewed By: amckinley
Differential Revision: https://secure.phabricator.com/D18718
This commit is contained in:
@@ -41,6 +41,20 @@ final class DifferentialChangesetOneUpRenderer
|
|||||||
|
|
||||||
$column_width = 4;
|
$column_width = 4;
|
||||||
|
|
||||||
|
$aural_minus = javelin_tag(
|
||||||
|
'span',
|
||||||
|
array(
|
||||||
|
'aural' => true,
|
||||||
|
),
|
||||||
|
'- ');
|
||||||
|
|
||||||
|
$aural_plus = javelin_tag(
|
||||||
|
'span',
|
||||||
|
array(
|
||||||
|
'aural' => true,
|
||||||
|
),
|
||||||
|
'+ ');
|
||||||
|
|
||||||
$out = array();
|
$out = array();
|
||||||
foreach ($primitives as $k => $p) {
|
foreach ($primitives as $k => $p) {
|
||||||
$type = $p['type'];
|
$type = $p['type'];
|
||||||
@@ -55,8 +69,10 @@ final class DifferentialChangesetOneUpRenderer
|
|||||||
if ($is_old) {
|
if ($is_old) {
|
||||||
if ($p['htype']) {
|
if ($p['htype']) {
|
||||||
$class = 'left old';
|
$class = 'left old';
|
||||||
|
$aural = $aural_minus;
|
||||||
} else {
|
} else {
|
||||||
$class = 'left';
|
$class = 'left';
|
||||||
|
$aural = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'old-file') {
|
if ($type == 'old-file') {
|
||||||
@@ -79,14 +95,20 @@ final class DifferentialChangesetOneUpRenderer
|
|||||||
),
|
),
|
||||||
$line);
|
$line);
|
||||||
|
|
||||||
|
$render = $p['render'];
|
||||||
|
if ($aural !== null) {
|
||||||
|
$render = array($aural, $render);
|
||||||
|
}
|
||||||
|
|
||||||
$cells[] = phutil_tag('th', array('class' => $class));
|
$cells[] = phutil_tag('th', array('class' => $class));
|
||||||
$cells[] = $no_copy;
|
$cells[] = $no_copy;
|
||||||
$cells[] = phutil_tag('td', array('class' => $class), $p['render']);
|
$cells[] = phutil_tag('td', array('class' => $class), $render);
|
||||||
$cells[] = $no_coverage;
|
$cells[] = $no_coverage;
|
||||||
} else {
|
} else {
|
||||||
if ($p['htype']) {
|
if ($p['htype']) {
|
||||||
$class = 'right new';
|
$class = 'right new';
|
||||||
$cells[] = phutil_tag('th', array('class' => $class));
|
$cells[] = phutil_tag('th', array('class' => $class));
|
||||||
|
$aural = $aural_plus;
|
||||||
} else {
|
} else {
|
||||||
$class = 'right';
|
$class = 'right';
|
||||||
if ($left_prefix) {
|
if ($left_prefix) {
|
||||||
@@ -98,6 +120,7 @@ final class DifferentialChangesetOneUpRenderer
|
|||||||
$oline = $p['oline'];
|
$oline = $p['oline'];
|
||||||
|
|
||||||
$cells[] = phutil_tag('th', array('id' => $left_id), $oline);
|
$cells[] = phutil_tag('th', array('id' => $left_id), $oline);
|
||||||
|
$aural = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'new-file') {
|
if ($type == 'new-file') {
|
||||||
@@ -120,8 +143,13 @@ final class DifferentialChangesetOneUpRenderer
|
|||||||
),
|
),
|
||||||
$line);
|
$line);
|
||||||
|
|
||||||
|
$render = $p['render'];
|
||||||
|
if ($aural !== null) {
|
||||||
|
$render = array($aural, $render);
|
||||||
|
}
|
||||||
|
|
||||||
$cells[] = $no_copy;
|
$cells[] = $no_copy;
|
||||||
$cells[] = phutil_tag('td', array('class' => $class), $p['render']);
|
$cells[] = phutil_tag('td', array('class' => $class), $render);
|
||||||
$cells[] = $no_coverage;
|
$cells[] = $no_coverage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user