Skip to content
Permalink
Browse files

[IMP] website_form: foucus on first input of modal

This commit focuses the first form input on the opened modal
(or footer button in case there's no form input).

This behavior will enable users to navigate through the modal
using keyboard right away.

task-1874350
  • Loading branch information...
dja-odoo committed Apr 17, 2019
1 parent 2ccaa4e commit 6965464c6afa7ce061861e9358ddf22aeb5eeb88
Showing with 6 additions and 0 deletions.
  1. +6 −0 addons/website_form/static/src/js/website_form_editor.js
@@ -49,6 +49,12 @@ odoo.define('website_form_editor', function (require) {
}
});

// Focus the first 'o_website_form_input' (or footer button in case there's no
// form input) to be able to navigate using keyboard
self.$modal.on('shown.bs.modal', function () {
$(this).find('.modal-body .o_website_form_input, .modal-footer .btn').first().focus();
});

// Destroy the modal when it is closed, as we will use many of them
self.$modal.on('hidden.bs.modal', function (e) {
self.$modal.remove();

0 comments on commit 6965464

Please sign in to comment.
You can’t perform that action at this time.