julienw / jquery-trap-input

This jQuery plugin is able to trap the keyboard input inside a DOM element
http://julienw.github.com/jquery-trap-input/
Other
23 stars 29 forks source link

The trap-input breaks if there is only one focusable item. #10

Open kalile opened 9 years ago

kalile commented 9 years ago

It doesn`t leave the loop in processTab if there is only one focusable item in the dialog. The solution would be very simple.

julienw commented 9 years ago

Hi, thanks for the report ! Do you happen to have a testcase somewhere ?

marcysutton commented 9 years ago

looks like there's an old PR open for that: https://github.com/julienw/jquery-trap-input/pull/5

julienw commented 9 years ago

Thanks for the reminder, looks like I'm late handling all this.

I'll try to look at it tomorrow, but otherwise this will have to wait one more week as I'm leaving for holidays.

kalile commented 9 years ago

Nice Folks! About the fix, I would avoid the first loop, and just return in a previous check. But that solves the issue as well! :)

SaiKrishnam commented 8 years ago

Replace while(elt === elt.ownerDocument.activeElement) with while(elt === elt.ownerDocument.activeElement && curElt)

It works

julienw commented 8 years ago

Thanks !