When the last text field is reached, pressing Tab again seems to focus on a field in a hidden tab. This results in a blank screen appearing.
Is there a solution for this case?
When the last text field is reached, pressing Tab again seems to focus on a field in a hidden tab. This results in a blank screen appearing.
Is there a solution for this case?
I have run into this issue now too. Have a form with tabs. Want the 2nd and 3rd tab hidden until the record has been first saved. But if user hits tab key on last field on first tab, form goes blank. Are there any workarounds for this?
I came up with the following workaround:
frappe.ui.form.on( "DocType", {
refresh: function( frm ) {
$( ".frappe-control[data-fieldname='fieldname']" ).on( "keydown", function( e ){
if( e.keyCode === 9 || e.key === "Tab" ){
e.preventDefault();
frm.scroll_to_field( "top_field_on_same_tab" ); // optional - could leave off and see leave the user focused on the last field
return false;
}
} );
}
} );