fix: focus on first control after navigating to next document (#8460)
This commit is contained in:
parent
59f6dc96c0
commit
c212f878d7
1 changed files with 10 additions and 2 deletions
|
|
@ -117,18 +117,20 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
|
||||
add_nav_keyboard_shortcuts() {
|
||||
frappe.ui.keys.add_shortcut({
|
||||
shortcut: 'shift+>',
|
||||
shortcut: 'shift+ctrl+>',
|
||||
action: () => this.navigate_records(0),
|
||||
page: this.page,
|
||||
description: __('Go to next record'),
|
||||
ignore_inputs: true,
|
||||
condition: () => !this.is_new()
|
||||
});
|
||||
|
||||
frappe.ui.keys.add_shortcut({
|
||||
shortcut: 'shift+<',
|
||||
shortcut: 'shift+ctrl+<',
|
||||
action: () => this.navigate_records(1),
|
||||
page: this.page,
|
||||
description: __('Go to previous record'),
|
||||
ignore_inputs: true,
|
||||
condition: () => !this.is_new()
|
||||
});
|
||||
}
|
||||
|
|
@ -837,10 +839,16 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
frappe.call('frappe.desk.form.utils.get_next', args).then(r => {
|
||||
if (r.message) {
|
||||
frappe.set_route('Form', this.doctype, r.message);
|
||||
this.focus_on_first_input();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
focus_on_first_input() {
|
||||
let $first_input_el = $(frappe.container.page).find('.frappe-control:visible').eq(0);
|
||||
$first_input_el.find('input, select, textarea').focus();
|
||||
}
|
||||
|
||||
rename_doc() {
|
||||
frappe.model.rename_doc(this.doctype, this.docname, () => this.refresh_header());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue