accessibility - Focusing on revealed(previously hidden) div - what is the right way -
do need move focus on hidden, revealed clicking/touching on link, div? i'll explain following example:
html:
<a href="javascript:void(0)">content</a> <div>blablabla</div> css:
div { display:none; width: 500px; height:200px; line-height: 200px; background: #007; color: #fff; text-align: center; } .block { display:block; } a:focus { border: 2px solid red; } jquery:
$(function () { $("a").on("click touchstart", function () { $("div").addclass("block"); }); }); as can see, focus remained on link when it's clicked. need remove focus revealed div? if so, should tabindex it? nice see examples(not necessarily, of course) of well, more clear of how should done.
dialog modal
https://www.w3.org/tr/wai-aria-practices-1.1/#dialog_modal
- when dialog opens, focus typically set on first focusable element.
- when dialog closes, focus returns element had focus before dialog invoked. control opened dialog.
the first focusable element typically close button. dialog's title, depending on how choose code , user testing.
disclosure widget
this depends on nature of content within.
if using menu button, read this: https://www.w3.org/tr/wai-aria-practices-1.1/#menubutton
if using accordion, read this: https://www.w3.org/tr/wai-aria-practices-1.1/#accordion
if way hide content otherwise not hidden screen reader, may not need manage focus @ all.
if reveals content otherwise hidden screen reader may need put
aria-expandedon , change value accordingly, , potentially not move focus @ all.if opens content has interactive controls primary purpose of widget, may need put focus on first interactive control.
in other words, depends. why seeing live examples important offer guidance.
i can tell see need change <a href="javascript:void(0)">content</a> <button>content</button> since not taking user new page. in short, if href attribute not new url (or valid named anchor on page), should not <a href> @ all. if cannot right-click , open in new tab, should not <a href>.
Comments
Post a Comment