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 the accessibility of the Discover screen #12681

Merged
merged 6 commits into from
Jul 12, 2017
Merged
Show file tree
Hide file tree
Changes from 5 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 @@ -54,16 +54,16 @@ <h3 class="sidebar-list-header-label" id="available_fields" tabindex="0">Availab
ng-class="{ 'kuiButton--basic': !filter.active, 'kuiButton--primary': filter.active, 'hidden-xs': !showFields, 'hidden-sm': !showFields }"
class="kuiButton kuiButton--small pull-right discover-field-filter-toggle"
ng-click="showFilter = !showFilter"
aria-label="Show field settings"
aria-haspopup="true"
aria-expanded="{{showFilter}}"
aria-label="{{showFilter ? 'Hide' : 'Show'}} field settings"
aria-expanded="{{!!showFilter}}"
aria-controls="discover-field-filter"
>
<span aria-hidden="true" class="kuiIcon fa-gear"></span>
</button>
</h3>
</div>

<div class="sidebar-item discover-field-details" ng-show="showFilter">
<div class="sidebar-item discover-field-details" ng-show="showFilter" id="discover-field-filter">
Copy link
Contributor

Choose a reason for hiding this comment

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

Really minor nit, but per our HTML style guide, can we write IDs in camel case, for both this ID and the other ones we're adding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely not nit-picking, but me not reading the style-guide carefully enough. Thanks for pointing this out. Fixed it. The file itself (and I assume several others) contain quite some more ids not using camel-case. But I think, that needs to be addressed in a different PR.

<form role="form">
<div class="form-group">
<label for="discoverFieldChooserFilterAggregatable">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<button
class="discover-field-details-item-button"
ng-click="onAddFilter(field, bucket.value, '+')"
aria-label="Filter for this value"
data-test-subj="plus-{{::field.name}}-{{::bucket.display}}"
>
<span
Expand All @@ -53,6 +54,7 @@
<button
class="discover-field-details-item-button"
ng-click="onAddFilter(field, bucket.value, '-')"
aria-label="Filter out this value"
data-test-subj="minus-{{::field.name}}-{{::bucket.display}}"
>
<span
Expand Down
6 changes: 4 additions & 2 deletions src/core_plugins/kibana/public/discover/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h1 tabindex="0" id="kui_local_breadcrumb" class="kuiLocalBreadcrumb">
name="discoverSearch"
ng-submit="fetch()"
>
<div class="typeahead" kbn-typeahead="discover" on-select="fetch()">
<div class="typeahead" kbn-typeahead="discover" on-select="fetch()" role="search">
<div class="kuiLocalSearch">
<div class="kuiLocalSearchAssistedInput">
<input
Expand All @@ -33,13 +33,15 @@ <h1 tabindex="0" id="kui_local_breadcrumb" class="kuiLocalBreadcrumb">
ng-model="state.query"
placeholder="Search... (e.g. status:200 AND extension:PHP)"
aria-label="Search input"
aria-describedby="discover-lucene-syntax-hint"
type="text"
class="kuiLocalSearchInput kuiLocalSearchInput--lucene"
ng-class="{'kuiLocalSearchInput-isInvalid': discoverSearch.$invalid}"
>
<div class="kuiLocalSearchAssistedInput__assistance">
<p class="kuiText">
<a
id="discover-lucene-syntax-hint"
class="kuiLink"
ng-href="{{queryDocLinks.luceneQuerySyntax}}"
target="_blank"
Expand Down Expand Up @@ -72,7 +74,7 @@ <h1 tabindex="0" id="kui_local_breadcrumb" class="kuiLocalBreadcrumb">
></filter-bar>
</div>
<div class="row">
<div class="col-md-2 sidebar-container collapsible-sidebar">
<div class="col-md-2 sidebar-container collapsible-sidebar" id="discover-sidebar">
<disc-field-chooser
columns="state.columns"
hits="rows"
Expand Down
8 changes: 8 additions & 0 deletions src/ui/public/collapsible_sidebar/collapsible_sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ uiModules
`<button
data-test-subj="collapseSideBarButton"
type="button"
aria-expanded="true"
aria-label="Toggle sidebar"
class="kuiCollapseButton sidebar-collapser"
></button>`
);
// If the collapsable element has an id, also set aria-controls
if ($elem.attr('id')) {
$collapser.attr('aria-controls', $elem.attr('id'));
}
const $icon = $('<span class="kuiIcon fa-chevron-circle-left"></span>');
$collapser.append($icon);
const $siblings = $elem.siblings();
Expand All @@ -39,11 +45,13 @@ uiModules
$elem.removeClass('closed');
$icon.addClass('fa-chevron-circle-left');
$icon.removeClass('fa-chevron-circle-right');
$collapser.attr('aria-expanded', 'true');
} else {
isCollapsed = true;
$elem.addClass('closed');
$icon.removeClass('fa-chevron-circle-left');
$icon.addClass('fa-chevron-circle-right');
$collapser.attr('aria-expanded', 'false');
}

if (hasSingleSibling) {
Expand Down