bug with modal dialog

bug with modal dialog

When the focus exits the dialog and enter again on the document it set on the first element focusable, and don't go to the second neither go back, it remains locked.

Also, the focus order on buttons of the dialog are inverted.