fixed issue with focus handling in forms

Ich you create a form append and then remove it from the screen you get
an RangeError because next() calls itself infinitely

This is a problem since the event handlers in the form don't get removed if it is detached from a screen.
 In my fix I simply check for the visibility of the parent form