{"id":30,"date":"2022-10-28T23:57:39","date_gmt":"2022-10-28T23:57:39","guid":{"rendered":"https:\/\/docs.joedolson.com\/wp-accessibility\/?p=30"},"modified":"2022-10-28T23:57:39","modified_gmt":"2022-10-28T23:57:39","slug":"add-tabindex-to-elements","status":"publish","type":"post","link":"https:\/\/docs.joedolson.com\/wp-accessibility\/2022\/10\/28\/add-tabindex-to-elements\/","title":{"rendered":"Add tabindex to elements"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">WP Accessibility looks for any <code>div<\/code> or <code>span<\/code> with <code>role=\"button\"<\/code> that does not already have a tabindex value, as well as any <code>a<\/code> element with <code>role=\"button\"<\/code> that has neither a <code>tabindex<\/code> attribute nor an <code>href<\/code> attribute. (An anchor without a hyperlink reference is not a link, and is not natively focusable.)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Adding the role of button very strongly suggests that these elements are being used as controls, but the lack of <code>tabindex<\/code> or <code>href<\/code> attributes means that they cannot be visited from the keyboard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This does not guarantee that these fake buttons will be usable &#8211; if they only have mouse or touch events attached, then the keyboard may still not be able to activate them. However, the most common attached event is the <code>click<\/code> event, and that accepts both mouse and keyboard actions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WP Accessibility looks for any div or span with role=&#8221;button&#8221; that does not already have a tabindex value, as well as any a element with role=&#8221;button&#8221; that has neither a tabindex attribute nor an href attribute. (An anchor without a hyperlink reference is not a link, and is not natively focusable.) Adding the role of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-30","post","type-post","status-publish","format-standard","hentry","category-remediation"],"_links":{"self":[{"href":"https:\/\/docs.joedolson.com\/wp-accessibility\/wp-json\/wp\/v2\/posts\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.joedolson.com\/wp-accessibility\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.joedolson.com\/wp-accessibility\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.joedolson.com\/wp-accessibility\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.joedolson.com\/wp-accessibility\/wp-json\/wp\/v2\/comments?post=30"}],"version-history":[{"count":1,"href":"https:\/\/docs.joedolson.com\/wp-accessibility\/wp-json\/wp\/v2\/posts\/30\/revisions"}],"predecessor-version":[{"id":31,"href":"https:\/\/docs.joedolson.com\/wp-accessibility\/wp-json\/wp\/v2\/posts\/30\/revisions\/31"}],"wp:attachment":[{"href":"https:\/\/docs.joedolson.com\/wp-accessibility\/wp-json\/wp\/v2\/media?parent=30"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.joedolson.com\/wp-accessibility\/wp-json\/wp\/v2\/categories?post=30"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.joedolson.com\/wp-accessibility\/wp-json\/wp\/v2\/tags?post=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}