On 4 mei, 09:41, Klaus Hartl <[EMAIL PROTECTED]> wrote:
> Gilles (Webunity) wrote:
> > Guys,
>
> > It has been a long time since the first blockUI and "window" plugins
> > (e.g. lightbox/thickbox) became available. However, i still didn't see
> > this piece of code in any of these sollutions. All projects have
> > thesame "bug", you can TAB out of the lightbox, to the underlying
> > page. (For a demo, open any project demo page, open the window and hit
> > TAB a few times. Eventually you will "jump" the page to another
> > location.. Not very user friendly...).
>
> > Especially in blockUI this snippet can be usefull:
>
> > /**
> >  * keepFocusInside (The name needs some work)
> >  * Basicly it checks to see if the element which wants to receive
> >focus
> >  * is a direct child of the SOME_ELEMENT you pass. If not, it returns
> > false.
> >  */
> > function keepFocusInside(oEvent, oParent) {
> >    if (oElement = oEvent.srcElement || oEvent.target) {
> >            return jQuery(oElement).parents(oParent).length;
> >    } else {
> >            // For all other browsers
> >            return true;
> >    }
>
> > }
>
> > Usage When the "block" starts:
> > jQuery(document).focus(function(oEvent) { return
> > keepFocusInside(oEvent, SOME_ELEMENT); });
>
> > Usage When the "block" ends:
> > jQuery(document).unfocus(function(oEvent) { return
> > keepFocusInside(oEvent, SOME_ELEMENT); });
>
> > HTH,
>
> > Gilles
>
> Gilles, actually something like that is already integrated in Thickbox
> Reloaded:
>
> function blockKeys(e) {
>                  var allowed = $('a, input, select, textarea', modal);
>                  for (var i = 0, k = allowed.length; i < k; i++) {
>                      if (allowed[i] == e.target) {
>                          return true;
>                      }
>                  }
>                  return false;
>              }
>
> As I borrowed that from the BlockUI plugin, it's not correct to state
> any of the solutions you're mentioning are lacking this.
>
> Thanks for sharing anyway!
>
> -- Klaus- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

Well, sorry Klaus, but i based this conclusion on this page:
http://malsup.com/jquery/block/#dialog

Show the dialog (in FF 2.0) and start tabbing. You'll soon see that
the focus jumps to the "tabs" on top of the screen. I didn't actually
"look" into the code, so sorry for that remark.

p.s. in your code.. Isn't that lacking the "button" element?

Just thought i'd share my code, and maybe improve that a bit...

Reply via email to