Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Visualize screen-reader accessibility. #11599

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes here, just formatting.

>
</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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes here, just formatting.

>
</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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm that we should use the term "Y axis" here instead of "value 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}}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use aria-label here instead of title. Because aria-label overrides any text content, we also need to include the index pattern ID here.

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`}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use aria-label instead of title. And to provide context, we'll also append the word "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