Skip to content

Commit e64ae62

Browse files
authored
Improve Management screen-reader accessibility. (#11601)
* Improve Management screen-reader accessibility: - Improve description of image generated by an Image URL scripted field. Allow formatted label to be presented in lieu of default alt attribute. - Remove unnecessary title attribute from Create Index Pattern ISO week date link. - Add aria-label for Edit Index Pattern tabs. - Add aria-label for Edit Saved Objects tabs.
1 parent 366bd77 commit e64ae62

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
class="kuiLink"
7777
href="https://en.wikipedia.org/wiki/ISO_week_date"
7878
target="_blank"
79-
title="Wikipedia: ISO Week Date"
8079
translate="KIBANA-WIKI_ISO_WEEK_DATE"
8180
></a>
8281
</p>

src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@
7373
class="kuiTab"
7474
ng-repeat="editSection in editSections"
7575
ng-class="{ 'kuiTab-isSelected': state.tab === editSection.index }"
76-
title="{{ editSection.title }}"
7776
ng-click="changeTab(editSection)"
7877
data-test-subj="tab-{{ editSection.index }}"
7978
>
8079
{{ editSection.title }}
81-
<span data-test-subj="tab-count-{{ editSection.index }}">
80+
<span
81+
data-test-subj="tab-count-{{ editSection.index }}"
82+
aria-label="{{:: editSection.count + ' ' + editSection.title}}"
83+
>
8284
({{ editSection.count }})
8385
</span>
8486
</button>

src/core_plugins/kibana/public/management/sections/objects/_objects.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ <h1 class="kuiTitle">
4848
class="kuiTab kbn-management-tab"
4949
ng-class="{ 'kuiTab-isSelected': state.tab === service.title }"
5050
ng-repeat="service in services"
51-
title="{{ service.title }}"
5251
ng-click="changeTab(service)"
5352
>
5453
{{ service.title }}
55-
<small>
56-
({{service.data.length}}<span ng-show="service.total > service.data.length"> of {{service.total}}</span>)
54+
<small aria-label="{{:: service.data.length + ' of ' + service.total + ' ' + service.title }}">
55+
({{service.data.length}}<span ng-show="service.total > service.data.length"> of {{service.total}}</span>)
5756
</small>
5857
</button>
5958
</div>

src/ui/public/stringify/types/url.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,28 @@ export function stringifyUrl(Private) {
8989

9090
html: function (rawValue, field, hit) {
9191
const url = _.escape(this._formatUrl(rawValue));
92-
let label = _.escape(this._formatLabel(rawValue, url));
92+
const label = _.escape(this._formatLabel(rawValue, url));
9393

9494
switch (this.param('type')) {
9595
case 'img':
96-
return '<img src="' + url + '" alt="' + label + '" title="' + label + '">';
96+
// If the URL hasn't been formatted to become a meaningful label then the best we can do
97+
// is tell screen readers where the image comes from.
98+
const imageLabel =
99+
label === url
100+
? `A dynamically-specified image located at ${url}`
101+
: label;
102+
103+
return `<img src="${url}" alt="${imageLabel}">`;
97104
default:
105+
let linkLabel;
106+
98107
if (hit && hit.highlight && hit.highlight[field.name]) {
99-
label = getHighlightHtml(label, hit.highlight[field.name]);
108+
linkLabel = getHighlightHtml(label, hit.highlight[field.name]);
109+
} else {
110+
linkLabel = label;
100111
}
101112

102-
return '<a href="' + url + '" target="_blank">' + label + '</a>';
113+
return `<a href="${url}" target="_blank">${linkLabel}</a>`;
103114
}
104115
}
105116
};

0 commit comments

Comments
 (0)