Skip to content

Commit

Permalink
Improve accessibility of the visualize editor (#13780)
Browse files Browse the repository at this point in the history
* Use aria-expanded and better labels for agg collapsables

* Fix all agg options collapsables, fix #12892

* Label all vis editor inputs correctly, fix #11859

* Fix broken functional test
  • Loading branch information
timroes authored and Tim Roes committed Aug 31, 2017
1 parent 10b9a6b commit b296d86
Show file tree
Hide file tree
Showing 27 changed files with 140 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
<div>
<div class="kuiSideBarCollapsibleTitle">
<div
kbn-accessible-click
aria-expanded="{{!!showColorRange}}"
aria-controls="gaugeOptionsRanges"
aria-label="Toggle range options"
class="kuiSideBarCollapsibleTitle__label"
ng-click="showColorRange = !showColorRange"
>
Expand All @@ -92,7 +96,7 @@
</div>
</div>

<div ng-show="showColorRange" class="kuiSideBarCollapsibleSection">
<div id="gaugeOptionsRanges" ng-show="showColorRange" class="kuiSideBarCollapsibleSection">
<div class="kuiSideBarSection">
<table class="vis-editor-agg-editor-ranges form-group" ng-show="vis.params.gauge.colorsRange.length">
<tr>
Expand Down Expand Up @@ -158,6 +162,10 @@
<div ng-show="vis.params.gauge.colorsRange.length > 1">
<div class="kuiSideBarCollapsibleTitle">
<div
kbn-accessible-click
aria-expanded="{{!!showColorOptions}}"
aria-controls="gaugeOptionsColors"
aria-label="Toggle color options"
class="kuiSideBarCollapsibleTitle__label"
ng-click="showColorOptions = !showColorOptions"
>
Expand All @@ -174,7 +182,7 @@
</span>
</div>
</div>
<div ng-if="showColorOptions" class="kuiSideBarCollapsibleSection">
<div id="gaugeOptionsColors" ng-if="showColorOptions" class="kuiSideBarCollapsibleSection">
<div class="kuiSideBarSection">
<div class="kuiSideBarFormRow">
<label class="kuiSideBarFormRow__label" for="colorSchema">
Expand Down Expand Up @@ -203,13 +211,13 @@
</div>
</div>





<div>
<div class="kuiSideBarCollapsibleTitle">
<div
kbn-accessible-click
aria-expanded="{{!!showStyle}}"
aria-controls="gaugeOptionsStyle"
aria-label="Toggle style options"
class="kuiSideBarCollapsibleTitle__label"
ng-click="showStyle = !showStyle"
>
Expand All @@ -226,7 +234,7 @@
</span>
</div>
</div>
<div ng-if="showStyle" class="kuiSideBarCollapsibleSection">
<div id="gaugeOptionsStyle" ng-if="showStyle" class="kuiSideBarCollapsibleSection">

<div class="kuiSideBarSection">
<div ng-hide="vis.params.gauge.type === 'simple'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
class="kuiSideBarCollapsibleTitle__label"
ng-click="toggleColorRangeSection()"
kbn-accessible-click
aria-expanded="{{!!showColorRange}}"
aria-controls="heatmapOptionsRanges"
aria-label="Toggle custom ranges options"
>
<span
aria-hidden="true"
Expand All @@ -104,7 +107,12 @@
>
</div>

<div ng-if="vis.params.setColorRange" ng-show="showColorRange" class="kuiSideBarCollapsibleSection">
<div
id="heatmapOptionsRanges"
ng-if="vis.params.setColorRange"
ng-show="showColorRange"
class="kuiSideBarCollapsibleSection"
>
<div class="kuiSideBarSection">
<table class="vis-editor-agg-editor-ranges form-group" ng-show="vis.params.colorsRange.length">
<tr>
Expand Down Expand Up @@ -172,6 +180,8 @@
class="kuiSideBarCollapsibleTitle__label"
ng-click="toggleLabelSection()"
kbn-accessible-click
aria-expanded="{{!!showLabels}}"
aria-controls="heatmapOptionsLabels"
>
<span
aria-hidden="true"
Expand All @@ -192,7 +202,12 @@
class="kuiSideBarSectionTitle__action"
>
</div>
<div ng-if="vis.params.valueAxes[0].labels.show" ng-show="showLabels" class="kuiSideBarCollapsibleSection">
<div
id="heatmapOptionsLabels"
ng-if="vis.params.valueAxes[0].labels.show"
ng-show="showLabels"
class="kuiSideBarCollapsibleSection"
>
<div class="kuiSideBarSection">
<div class="kuiSideBarFormRow">
<label class="kuiSideBarFormRow__label" for="rotateLabels">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
class="kuiSideBarCollapsibleTitle__label"
ng-click="isGridOpen = !isGridOpen"
kbn-accessible-click
aria-expanded="{{!!isGridOpen}}"
aria-controls="visGridOptions"
aria-label="Toggle grid options"
>
<span
aria-hidden="true"
Expand All @@ -16,7 +19,7 @@
</div>
</div>

<div ng-show="isGridOpen" class="kuiSideBarCollapsibleSection">
<div id="visGridOptions" ng-show="isGridOpen" class="kuiSideBarCollapsibleSection">
<!-- General -->
<div class="kuiSideBarSection">
<div class="kuiSideBarFormRow">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
class="kuiSideBarCollapsibleTitle__label"
ng-click="isSeriesOpen = !isSeriesOpen"
kbn-accessible-click
aria-expanded="{{!!isSeriesOpen}}"
aria-controls="visSeriesOptions{{$index}}"
aria-label="Toggle {{chart.data.label}} options"
>
<span
aria-hidden="true"
Expand All @@ -27,7 +30,7 @@
</div>
</div>

<div ng-show="isSeriesOpen" class="kuiSideBarCollapsibleSection">
<div id="visSeriesOptions{{$index}}" ng-show="isSeriesOpen" class="kuiSideBarCollapsibleSection">
<!-- General -->
<div class="kuiSideBarSection">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
class="kuiSideBarCollapsibleTitle__label"
ng-click="isValueAxisOpen = !isValueAxisOpen"
kbn-accessible-click
aria-expanded="{{!!isValueAxisOpen}}"
aria-controls="axisOptions{{axis.id}}"
aria-label="Toggle {{axis.name}} options"
>
<span
aria-hidden="true"
Expand All @@ -48,7 +51,7 @@
></button>
</div>

<div ng-show="isValueAxisOpen" class="kuiSideBarCollapsibleSection">
<div id="axisOptions{{axis.id}}" ng-show="isValueAxisOpen" class="kuiSideBarCollapsibleSection">
<!-- General -->
<div class="kuiSideBarSection">
<div class="kuiSideBarFormRow">
Expand Down
7 changes: 5 additions & 2 deletions src/ui/public/agg_types/controls/date_ranges.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
<table class="vis-editor-agg-editor-ranges form-group" ng-show="agg.params.ranges.length">
<tr>
<th>
<label>From</label>
<label id="visEditorDateRangeFrom{{agg.id}}">From</label>
</th>
<th colspan="2">
<label>To</label>
<label id="visEditorDateRangeTo{{agg.id}}">To</label>
</th>
</tr>

<tr
ng-repeat="range in agg.params.ranges track by $index">
<td class="kbn-timepicker">
<input
aria-labelledby="visEditorDateRangeFrom{{agg.id}}"
ng-model="range.from"
validate-date-math
type="text"
Expand All @@ -21,6 +22,7 @@
</td>
<td class="kbn-timepicker">
<input
aria-labelledby="visEditorDateRangeTo{{agg.id}}"
ng-model="range.to"
validate-date-math
class="form-control"
Expand All @@ -29,6 +31,7 @@
<td>
<button
type="button"
aria-label="Remove this range"
ng-click="agg.params.ranges.splice($index, 1)"
class="kuiButton kuiButton--danger kuiButton--small">
<i class="fa fa-times" ></i>
Expand Down
22 changes: 18 additions & 4 deletions src/ui/public/agg_types/controls/extended_bounds.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
<div ng-if="aggParam.shouldShow(agg)">
<div>
<label>Extended Bounds</label>
<label id="extendedBoundsLabel{{agg.id}}">Extended Bounds</label>
<kbn-info info="Min and Max do not filter the results, but rather extend the bounds of the result set."></kbn-info>
</div>
<div class="vis-editor-agg-form-row">
<div class="form-group">
<div>Min <small>(optional)</small></div>
<label
id="extendedBoundsMinLabel{{agg.id}}"
for="extendedBoundsMinInput{{agg.id}}"
>
Min <small>(optional)</small>
</label>
<input
id="extendedBoundsMinInput{{agg.id}}"
aria-labelledby="extendedBoundsLabel{{agg.id}} extendedBoundsMinLabel{{agg.id}}"
ng-model="agg.params.extended_bounds.min"
type="number"
class="form-control"
name="extended_bounds.min" />
</div>
<div class="form-group">
<div>Max <small>(optional)</small></div>
<label
id="extendedBoundsMaxLabel{{agg.id}}"
for="extendedBoundsMaxInput{{agg.id}}"
>
Max <small>(optional)</small>
</label>
<input
id="extendedBoundsMaxInput{{agg.id}}"
aria-labelledby="extendedBoundsLabel{{agg.id}} extendedBoundsMaxLabel{{agg.id}}"
ng-model="agg.params.extended_bounds.max"
type="number"
class="form-control"
name="extended_bounds.max" />
</div>
</div>
</div>
</div>
3 changes: 2 additions & 1 deletion src/ui/public/agg_types/controls/field.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<div class="form-group">
<label for="field">
<label>
Field
</label>

<ui-select
title="Aggregation Field"
name="field"
required
class="vis-editor-field-ui-select field-select"
Expand Down
12 changes: 9 additions & 3 deletions src/ui/public/agg_types/controls/filters.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="form-group">
<div ng-repeat="filter in agg.params.filters">
<div class="vis-editor-agg-header">
<label>
<label for="visEditorFilterInput{{agg.id}}">
Filter {{$index + 1}}
<span ng-if="filter.label">- {{ filter.label }}</span>
</label>
Expand All @@ -10,11 +10,15 @@
<button
ng-click="showConfig = !showConfig"
type="button"
aria-label="Toggle filter label"
aria-expanded="{{!!showConfig}}"
aria-controls="visEditorFilterLabel{{agg.id}}"
class="kuiButton kuiButton--basic kuiButton--small">
<i class="fa fa-tag"></i>
</button>
<button
type="button"
aria-label="Remove this filter"
ng-click="agg.params.filters.splice($index, 1)"
class="kuiButton kuiButton--danger kuiButton--small">
<i class="fa fa-times"></i>
Expand All @@ -24,16 +28,18 @@

<div class="form-group">
<input
id="visEditorFilterInput{{agg.id}}"
parse-query
ng-model="filter.input.query"
type="text"
class="form-control"
name="filter{{$index}}">
</div>

<div class="form-group" ng-show="showConfig">
<label>Filter {{$index + 1}} label</label>
<div class="form-group" ng-show="showConfig" id="visEditorFilterLabel{{agg.id}}">
<label for="visEditorFilterLabelInput{{agg.id}}">Filter {{$index + 1}} label</label>
<input
id="visEditorFilterLabelInput{{agg.id}}"
ng-model="filter.label"
placeholder="Label"
type="text"
Expand Down
5 changes: 4 additions & 1 deletion src/ui/public/agg_types/controls/interval.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="form-group">
<label>
<label for="visEditorInterval{{agg.id}}">
Interval
<kbn-info
ng-show="agg.buckets.getInterval().scaled"
Expand All @@ -9,6 +9,7 @@
</kbn-info>
</label>
<select
id="visEditorInterval{{agg.id}}"
ng-if="aggParam.options"
ng-model="agg.params.interval"
ng-change="agg.write()"
Expand All @@ -19,6 +20,7 @@
<option value="">-- select a valid interval --</option>
</select>
<input
aria-label="Custom interval"
type="text"
name="customInterval"
ng-model="agg.params.customInterval"
Expand All @@ -28,6 +30,7 @@
class="form-control"
required />
<input
id="visEditorInterval{{agg.id}}"
ng-if="!aggParam.options"
ng-model="agg.params.interval"
required
Expand Down
Loading

0 comments on commit b296d86

Please sign in to comment.