Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is tabIndex: 0 in links considered a good practice in order to avoid href="javascript: void(0);"?

a href="javascript: void(0)" is considered a bad practice and I can't use href="#" in every case, so I'm thinking to add an empty a with tabIndex=0 in order to be accessible with keyboard.

Is it considered a good practice?

P.S. Bootstrap's dropdown needs <a> in inner elements for keyboard navigation, so I have to use <a>.

like image 826
Naele Avatar asked Oct 28 '22 21:10

Naele


1 Answers

If you don’t have a href then it’s not a link, period.

You can use <button type="button"> in bootstrap dropdown menu so I recommend you do it.

like image 55
MatTheCat Avatar answered Nov 15 '22 01:11

MatTheCat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!