WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: In-page links and programmatic focus

for

From: Bryan Garaventa
Date: Sep 13, 2016 12:04PM


Just to clarify, the confusion here isn't whether focus moves, but when and to which elements. Non-focusable elements cannot receive focus.

E.G If you have a same page link that points to the ID of another focusable element like a link or button, then focus will move, because these elements are natively focusable in the browser.

However, static elements like headings, span tags, etc, are not focusable in the browser. Only when the tabindex attribute is added to such static elements do these elements become focusable in the browser, allowing focus to move to them. This is why tabindex="-1" is still needed in these cases.

For static web pages that don't rely on comprehensive client side scripting, typically this is enough, but when inadvertent page refreshes occur when the page url changes, some ATs have trouble dealing with this and the focus movement at the same time, in which case the JavaScript method is still the most reliable across all browsers and platforms.

Bryan Garaventa
Accessibility Fellow
SSB BART Group, Inc.
<EMAIL REMOVED>
415.624.2709 (o)
www.SSBBartGroup.com