Skip to content

Commit

Permalink
Improve Visualize screen-reader accessibility: (elastic#11599)
Browse files Browse the repository at this point in the history
- Add aria-label to Tile Map visualization's 'Fit Data Bounds' button.
- Add aria-label for Visualize Editor sidebar index pattern.
- Add aria-label to Time Series Visual Builder Annotation icon options.
- Add aria-label for Time Series Visual Builder AggSelectOption.
- Add aria-label to Time Series Visual Builder Annotation selected icon option.
- Adjust aria-labels for Heatmap visualization options.
- Adjust aria-labels for ValueAxes add and remove buttons.
  • Loading branch information
cjcenizal committed May 11, 2017
1 parent 78cb3a8 commit c21e339
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@
Custom Ranges
</span>
</div>
<input aria-label="enable"
ng-model="vis.params.setColorRange"
type="checkbox"
class="kuiSideBarSectionTitle__action"
ng-click="toggleColorRangeSection(true)"
<input
aria-label="Enable custom ranges"
ng-model="vis.params.setColorRange"
type="checkbox"
class="kuiSideBarSectionTitle__action"
ng-click="toggleColorRangeSection(true)"
>
</div>

Expand Down Expand Up @@ -172,10 +173,11 @@
Show Labels
</span>
</div>
<input aria-label="enable"
ng-model="valueAxis.labels.show"
type="checkbox"
class="kuiSideBarSectionTitle__action"
<input
aria-label="Show labels"
ng-model="valueAxis.labels.show"
type="checkbox"
class="kuiSideBarSectionTitle__action"
>
</div>
<div ng-if="valueAxis.labels.show" ng-show="showLabels" class="kuiSideBarCollapsibleSection">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
</div>

<button
aria-label="Add value axis"
data-test-subj="visualizeAddYAxisButton"
aria-label="Add Y axis"
ng-click="addValueAxis()"
tooltip="Add value axis"
tooltip="Add Y axis"
tooltip-append-to-body="true"
type="button"
class="fa fa-plus kuiSideBarSectionTitle__action"
Expand Down Expand Up @@ -37,9 +38,9 @@

<button
ng-hide="vis.params.valueAxes.length === 1"
aria-label="Remove value axis"
aria-label="Remove Y axis"
ng-click="removeValueAxis(axis)"
tooltip="Remove value axis"
tooltip="Remove Y axis"
tooltip-append-to-body="true"
type="button"
class="fa fa-remove kuiSideBarCollapsibleTitle__action"
Expand Down
7 changes: 6 additions & 1 deletion src/core_plugins/kibana/public/visualize/editor/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
novalidate
><!-- see http://goo.gl/9kgz5w -->

<div css-truncate title="{{indexPattern.id}}" ng-if="vis.type.requiresSearch" class="index-pattern">
<div
css-truncate
aria-label="{{:: 'Index pattern: ' + indexPattern.id}}"
ng-if="vis.type.requiresSearch"
class="index-pattern"
>
{{ indexPattern.id }}
</div>

Expand Down
12 changes: 8 additions & 4 deletions src/core_plugins/metrics/public/components/aggs/agg_select.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ class AggSelectOption extends Component {
note = (<span className="vis_editor__agg_select-note">(requires child aggregation)</span>);
}
return (
<div className="Select-option vis_editor__agg_select-heading"
<div
className="Select-option vis_editor__agg_select-heading"
onMouseEnter={this.handleMouseEnter}
onMouseDown={this.handleMouseDown}
onMouseMove={this.handleMouseMove}
title={label}>
ariaLabel={label}
>
<span className="Select-value-label" style={style}>
<strong>{label}</strong>
{note}
Expand All @@ -86,11 +88,13 @@ class AggSelectOption extends Component {
);
}
return (
<div className={this.props.className}
<div
className={this.props.className}
onMouseEnter={this.handleMouseEnter}
onMouseDown={this.handleMouseDown}
onMouseMove={this.handleMouseMove}
title={label}>
ariaLabel={label}
>
<span className="Select-value-label" style={style}>
{ this.props.children }
</span>
Expand Down
23 changes: 16 additions & 7 deletions src/core_plugins/metrics/public/components/icon_select.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@ class IconOption extends Component {

render() {
const icon = this.props.option.value;
const title = this.props.option.label;
const label = this.props.option.label;
return (
<div className={this.props.className}
onMouseEnter={this.handleMouseEnter}
onMouseDown={this.handleMouseDown}
onMouseMove={this.handleMouseMove}
title={title}>
<span className="Select-value-label">
<i className={`vis_editor__icon_select-option fa ${icon}`}></i>
>
<span
className="Select-value-label"
aria-label={`${label} icon`}
>
<span
className={`vis_editor__icon_select-option kuiIcon ${icon}`}
aria-hidden="true"
></span>
{ this.props.children }
</span>
</div>
Expand All @@ -60,9 +66,12 @@ function IconValue(props) {
const icon = props.value && props.value.value;
const label = props.value && props.value.label;
return (
<div className="Select-value" title={label}>
<span className="Select-value-label">
<i className={`vis_editor__icon_select-value fa ${icon}`}></i>
<div className="Select-value">
<span
className="Select-value-label"
aria-label={`${label} icon`}
>
<span className={`vis_editor__icon_select-value kuiIcon ${icon}`}></span>
{ props.children }
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/vis_maps/kibana_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function makeFitControl(fitContainer, kibanaMap) {
},
onAdd: function (leafletMap) {
this._leafletMap = leafletMap;
$(this._fitContainer).html('<a class="fa fa-crop" href="#" title="Fit Data Bounds"></a>')
$(this._fitContainer).html('<a class="kuiIcon fa-crop" href="#" aria-label="Fit Data Bounds"></a>')
.on('click', e => {
e.preventDefault();
this._kibanaMap.fitToData();
Expand Down
5 changes: 2 additions & 3 deletions test/functional/page_objects/point_series_page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export function PointSeriesPageProvider({ getService }) {
const remote = getService('remote');
const config = getService('config');
const testSubjects = getService('testSubjects');
const log = getService('log');

const defaultFindTimeout = config.get('timeouts.find');
Expand All @@ -21,9 +22,7 @@ export function PointSeriesPageProvider({ getService }) {
}

clickAddAxis() {
return remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector('button[aria-label="Add value axis"]')
return testSubjects.find('visualizeAddYAxisButton')
.click();
}

Expand Down

0 comments on commit c21e339

Please sign in to comment.