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

Make 'time picker' button in Discover no results prompt keyboard and screen-reader accessible. #13046

Merged
merged 3 commits into from
Jul 26, 2017

Conversation

cjcenizal
Copy link
Contributor

Fixes #12970

ng-click="kbnTopNav.toggle('filter')"
kbn-accessible-click
aria-expanded="{{kbnTopNav.isCurrent('filter')}}"
aria-label="time picker"
Copy link
Contributor

Choose a reason for hiding this comment

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

It's exactly the same label as the content currently is, so we can just remove this aria-label.

<h3>Expand your time range</h3>
<p>I see you are looking at an index with a date field. It is possible your query does not match anything in the current time range, or that there is no data at all in the currently selected time range. Click the button below to open the time picker. For future reference you can open the time picker by clicking on the <a class="kuiButton kuiButton--primary kuiButton--small" ng-click="kbnTopNav.toggle('filter')" aria-expanded="kbnTopNav.is('filter')" aria-label="time picker" data-test-subj="discoverNoResultsTimefilter"><span aria-hidden="true" class="kuiIcon fa-clock-o"></span> time picker</a> button in the top right corner of your screen.
I see you are looking at an index with a date field. It is possible your query does not match anything in the current time range, or that there is no data at all in the currently selected time range. Click the button below to open the time picker. For future reference you can open the time picker by clicking on the
<a
Copy link
Contributor

Choose a reason for hiding this comment

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

You didn't introduce this here, but I feel like nitpicking about it now (though no need to fix it) ;P
This should actually be a button and not an a imho, since it "does" something on the current page and doesn't navigate to another page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great call!

aria-expanded="{{kbnTopNav.isCurrent('filter')}}"
aria-label="time picker"
data-test-subj="discoverNoResultsTimefilter"
>
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this link doesn't have an href attribute it wouldn't get the link role by default so we should add this role manually.

<a
class="kuiButton kuiButton--primary kuiButton--small"
ng-click="kbnTopNav.toggle('filter')"
kbn-accessible-click
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you already discussed this, but can't find it right now: wouldn't it make sense to add ngAria as a dependency, to solve that basic issues (like automatically make ng-click stuff tabable and clickable by keyboard)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would you mind creating a new issue for this, with the "discuss" and "Accessibility" labels? This is an interesting idea and it seems like it would solve a good set of low-level issues! One tradeoff is that it's magic and relives the engineer of the responsibility of understanding and using ARIA well, which could be problematic when migrating Angular code to React.

@cjcenizal
Copy link
Contributor Author

@timroes Changing the element type to button seems to address all of your feedback. Mind taking another look?

Copy link
Contributor

@bhavyarm bhavyarm left a comment

Choose a reason for hiding this comment

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

LGTM

@bhavyarm
Copy link
Contributor

@cjcenizal all good. I don't see that severe warning anymore. Cheers!

@cjcenizal cjcenizal merged commit 1675529 into elastic:master Jul 26, 2017
@cjcenizal cjcenizal deleted the 12970/local-nav-aria branch July 26, 2017 23:24
cjcenizal added a commit to cjcenizal/kibana that referenced this pull request Jul 26, 2017
…screen-reader accessible. (elastic#13046)

* Make 'time picker' button in Discover no results prompt keyboard and screen-reader accessible.
cjcenizal added a commit that referenced this pull request Jul 26, 2017
…screen-reader accessible. (#13046) (#13134)

* Make 'time picker' button in Discover no results prompt keyboard and screen-reader accessible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants