Skip to content

Commit

Permalink
Add described-by attribute to duration-selection directive to make ch…
Browse files Browse the repository at this point in the history
…ildren inputs screen reader accessible. (elastic#19779)
  • Loading branch information
cjcenizal authored and maryia-lapata committed Jun 25, 2018
1 parent e707d25 commit 513a8b7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
class="durationSelectSize kuiTextInput watcherNumberInput"
min="0"
required
ng-model="durationSelect.size">
ng-model="durationSelect.size"
aria-label="Duration amount"
aria-describedby="{{durationSelect.describedBy}}"
>

<select
id="{{durationSelect.makeId('unit')}}"
name="{{durationSelect.makeId('unit')}}"
class="durationSelectUnit kuiSelect"
required
ng-model="durationSelect.unit"
ng-options="commonTimeUnit as timeUnit.labelPlural for (commonTimeUnit, timeUnit) in durationSelect.timeUnits"
aria-label="Duration time unit"
aria-describedby="{{durationSelect.describedBy}}"
></select>
<div>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ app.directive('durationSelect', function ($injector) {
minimumUnit: '=',
minimumSize: '=',
unit: '=',
size: '='
size: '=',
describedBy: '@',
},
template,
replace: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,21 @@ <h2 class="kuiSubText kuiSubduedText">

<div class="kuiFieldGroupSection">
<label
id="durationSelectTriggerIntervalSizeLabel"
for="durationSelectTriggerIntervalSize"
class="kuiLabel kuiVerticalRhythmSmall">
class="kuiLabel kuiVerticalRhythmSmall"
>
Run watch every
</label>
<div class="kuiVerticalRhythmSmall">

<div class="kuiVerticalRhythmSmall" id="durationSelectTriggerIntervalSize" role="group">
<duration-select
duration-id="triggerInterval"
minimum-unit="watchEditTitlePanel.triggerIntervalMinimumUnit"
minimum-size="watchEditTitlePanel.triggerIntervalMinimumSize"
unit="watchEditTitlePanel.triggerIntervalUnit"
size="watchEditTitlePanel.triggerIntervalSize"
described-by="durationSelectTriggerIntervalSizeLabel"
></duration-select>
</div>
<div class="kuiSubText kuiSubduedText kuiVerticalRhythmSmall watchEditTitlePanelIntervalValidation">
Expand Down

0 comments on commit 513a8b7

Please sign in to comment.