corrade-nucleus-nucleons

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 1  →  ?path2? @ 19
/base/000_base/bower_components/highcharts/js/modules/accessibility.src.js
@@ -1,5 +1,5 @@
/**
* @license Highcharts JS v5.0.10 (2017-03-31)
* @license Highcharts JS v5.0.12 (2017-05-24)
* Accessibility module
*
* (c) 2010-2017 Highsoft AS
@@ -158,7 +158,11 @@
if (point.graphic) {
point.graphic.element.setAttribute('role', 'img');
point.graphic.element.setAttribute('tabindex', '-1');
point.graphic.element.setAttribute('aria-label', a11yOptions.pointDescriptionFormatter && a11yOptions.pointDescriptionFormatter(point) ||
point.graphic.element.setAttribute('aria-label',
point.series.options.pointDescriptionFormatter &&
point.series.options.pointDescriptionFormatter(point) ||
a11yOptions.pointDescriptionFormatter &&
a11yOptions.pointDescriptionFormatter(point) ||
point.buildPointInfoString());
}
});
@@ -165,7 +169,10 @@
}
// Make series element accessible
if (this.chart.series.length > 1 || a11yOptions.describeSingleSeries) {
seriesEl.setAttribute('role', 'region');
seriesEl.setAttribute(
'role',
this.options.exposeElementToA11y ? 'img' : 'region'
);
seriesEl.setAttribute('tabindex', '-1');
seriesEl.setAttribute('aria-label', a11yOptions.seriesDescriptionFormatter && a11yOptions.seriesDescriptionFormatter(this) ||
this.buildSeriesInfoString());
@@ -410,9 +417,12 @@
return false;
}
 
// Recursively skip null points
if (newPoint.isNull && this.options.accessibility.keyboardNavigation &&
this.options.accessibility.keyboardNavigation.skipNullPoints) {
// Recursively skip null points or points in series that should be skipped
if (
newPoint.isNull &&
this.options.accessibility.keyboardNavigation.skipNullPoints ||
newPoint.series.options.skipKeyboardNavigation
) {
this.highlightedPoint = newPoint;
return this.highlightAdjacentPoint(next);
}
@@ -870,8 +880,10 @@
]
], {
// Only run this module if we have at least one legend - wait for it - item.
// Don't run if the legend is populated by a colorAxis.
validate: function() {
return chart.legend && chart.legend.allItems && !chart.colorAxis;
return chart.legend && chart.legend.allItems &&
!(chart.colorAxis && chart.colorAxis.length);
},
 
// Make elements focusable and accessible
@@ -945,7 +957,7 @@
(axesDesc.xAxis ? ('<div>' + axesDesc.xAxis + '</div>') : '') +
(axesDesc.yAxis ? ('<div>' + axesDesc.yAxis + '</div>') : '');
 
// Add shortcut to data table if export-csv is loaded
// Add shortcut to data table if export-data is loaded
if (chart.getCSV) {
tableShortcutAnchor.innerHTML = 'View as data table.';
tableShortcutAnchor.href = '#' + tableId;
@@ -995,7 +1007,7 @@
titleElement.id = titleId;
descElement.parentNode.insertBefore(titleElement, descElement);
chart.renderTo.setAttribute('role', 'region');
chart.container.setAttribute('aria-details', hiddenSectionId);
//chart.container.setAttribute('aria-details', hiddenSectionId); // JAWS currently doesn't handle this too well
chart.renderTo.setAttribute('aria-label', 'Interactive chart. ' + chartTitle +
'. Use up and down arrows to navigate with most screen readers.');
 
@@ -1037,31 +1049,38 @@
chart.addScreenReaderRegion(hiddenSectionId, tableId);
 
// Enable keyboard navigation
if (a11yOptions.keyboardNavigation) {
if (a11yOptions.keyboardNavigation.enabled) {
chart.addKeyboardNavEvents();
}
 
/* Wrap table functionality from export-csv */
/* Wrap table functionality from export-data */
 
// Keep track of columns
merge(true, options.exporting, {
csv: {
columnHeaderFormatter: function(series, key, keyLength) {
columnHeaderFormatter: function(item, key, keyLength) {
if (!item) {
return 'Category';
}
if (item instanceof H.Axis) {
return (item.options.title && item.options.title.text) ||
(item.isDatetimeAxis ? 'DateTime' : 'Category');
}
var prevCol = topLevelColumns[topLevelColumns.length - 1];
if (keyLength > 1) {
// We need multiple levels of column headers
// Populate a list of column headers to add in addition to the ones added by export-csv
if ((prevCol && prevCol.text) !== series.name) {
// Populate a list of column headers to add in addition to the ones added by export-data
if ((prevCol && prevCol.text) !== item.name) {
topLevelColumns.push({
text: series.name,
text: item.name,
span: keyLength
});
}
}
if (oldColumnHeaderFormatter) {
return oldColumnHeaderFormatter.call(this, series, key, keyLength);
return oldColumnHeaderFormatter.call(this, item, key, keyLength);
}
return keyLength > 1 ? key : series.name;
return keyLength > 1 ? key : item.name;
}
}
});
@@ -1074,12 +1093,13 @@
 
// Add accessibility attributes and top level columns
H.wrap(chart, 'viewData', function(proceed) {
if (!this.insertedTable) {
if (!this.dataTableDiv) {
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
 
var table = doc.getElementById(tableId),
head = table.getElementsByTagName('thead')[0],
body = table.getElementsByTagName('tbody')[0],
firstRow = body.firstChild.children,
firstRow = head.firstChild.children,
columnHeaderRow = '<tr><td></td>',
cell,
newCell;
@@ -1108,7 +1128,7 @@
each(topLevelColumns, function(col) {
columnHeaderRow += '<th scope="col" colspan="' + col.span + '">' + col.text + '</th>';
});
body.insertAdjacentHTML('afterbegin', columnHeaderRow);
head.insertAdjacentHTML('afterbegin', columnHeaderRow);
}
}
});