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

[5.x] Improve Management screen-reader accessibility. (#11601) #11696

Merged
merged 1 commit into from
May 10, 2017
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 @@ -76,7 +76,6 @@
class="kuiLink"
href="https://en.wikipedia.org/wiki/ISO_week_date"
target="_blank"
title="Wikipedia: ISO Week Date"
translate="KIBANA-WIKI_ISO_WEEK_DATE"
></a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@
class="kuiTab"
ng-repeat="editSection in editSections"
ng-class="{ 'kuiTab-isSelected': state.tab === editSection.index }"
title="{{ editSection.title }}"
ng-click="changeTab(editSection)"
data-test-subj="tab-{{ editSection.index }}"
>
{{ editSection.title }}
<span data-test-subj="tab-count-{{ editSection.index }}">
<span
data-test-subj="tab-count-{{ editSection.index }}"
aria-label="{{:: editSection.count + ' ' + editSection.title}}"
>
({{ editSection.count }})
</span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ <h1 class="kuiTitle">
class="kuiTab kbn-management-tab"
ng-class="{ 'kuiTab-isSelected': state.tab === service.title }"
ng-repeat="service in services"
title="{{ service.title }}"
ng-click="changeTab(service)"
>
{{ service.title }}
<small>
({{service.data.length}}<span ng-show="service.total > service.data.length"> of {{service.total}}</span>)
<small aria-label="{{:: service.data.length + ' of ' + service.total + ' ' + service.title }}">
({{service.data.length}}<span ng-show="service.total > service.data.length"> of {{service.total}}</span>)
</small>
</button>
</div>
Expand Down
19 changes: 15 additions & 4 deletions src/ui/public/stringify/types/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,28 @@ export function stringifyUrl(Private) {

html: function (rawValue, field, hit) {
const url = _.escape(this._formatUrl(rawValue));
let label = _.escape(this._formatLabel(rawValue, url));
const label = _.escape(this._formatLabel(rawValue, url));

switch (this.param('type')) {
case 'img':
return '<img src="' + url + '" alt="' + label + '" title="' + label + '">';
// If the URL hasn't been formatted to become a meaningful label then the best we can do
// is tell screen readers where the image comes from.
const imageLabel =
label === url
? `A dynamically-specified image located at ${url}`
: label;

return `<img src="${url}" alt="${imageLabel}">`;
default:
let linkLabel;

if (hit && hit.highlight && hit.highlight[field.name]) {
label = getHighlightHtml(label, hit.highlight[field.name]);
linkLabel = getHighlightHtml(label, hit.highlight[field.name]);
} else {
linkLabel = label;
}

return '<a href="' + url + '" target="_blank">' + label + '</a>';
return `<a href="${url}" target="_blank">${linkLabel}</a>`;
}
}
};
Expand Down