I think _handleTab is a better name for this function since we're not just watching tabbing here. And the second param should be $dlg, not $element since it is the dialog element and not an individual form element in the dialog.