-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Conversation
ng-click="kbnTopNav.toggle('filter')" | ||
kbn-accessible-click | ||
aria-expanded="{{kbnTopNav.isCurrent('filter')}}" | ||
aria-label="time picker" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" | ||
> |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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.
@timroes Changing the element type to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@cjcenizal all good. I don't see that severe warning anymore. Cheers! |
8a6df75
to
d12e70a
Compare
d12e70a
to
77cb9de
Compare
…screen-reader accessible. (elastic#13046) * Make 'time picker' button in Discover no results prompt keyboard and screen-reader accessible.
Fixes #12970