Better keep focus : avoid non visible focusable elements

This commit handles the visibility of elements in the keepFocus functionality, if an element of the list is not visible it tries to get the next focusable candidate.

I met this situation on a project with some hidden div at the top of the modal and the keepFocus was focusing hidden focusable element, which was not the "correct" behavior.
Please use multiple `var` declarations here.