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

  1. when dialog opens, focus typically set on first focusable element.
  2. 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.

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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -