Reputation: 781
How to give focus when using keyboard tab?
<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click" title="Prev"><span class="ui-icon ui-icon-circle-triangle-w">Prev</span></a>
I tried using css like this
ui-datepicker-prev:focus { border:1px solid red}
But this doesn't work well. Anyone know ?
Upvotes: 22
Views: 19777
Reputation: 31
tabindex="0" will make the focusable but not clickable with enter. href is needed.
Upvotes: 3
Reputation: 141
Either set tabindex="0" or specify href="javascript:;", It should be focusable.
Upvotes: 13
Reputation: 16
I ran into this same issue, browsers will not tab to <a>
unless a href
exists. I solved this by adding empty href
's to my anchor tags, like so
<a href="">Link</a>
Upvotes: -5
Reputation: 14123
First, class selector should start with a dot:
.ui-datepicker-prev:focus {border: 1px solid red; }
As for being able to use keyboard navigation for elements that are nonfocusable by default, setting tabindex="0"
attribute should help.
Upvotes: 15