From ba02d038f73a68f7f2620dfd557a706e87172b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 19 Aug 2022 07:27:30 +0200 Subject: [PATCH] js: consider select/textarea when setting focus on first dialog field (#68275) --- gadjo/static/js/gadjo.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gadjo/static/js/gadjo.js b/gadjo/static/js/gadjo.js index 3d7be9b..9b66d48 100644 --- a/gadjo/static/js/gadjo.js +++ b/gadjo/static/js/gadjo.js @@ -250,8 +250,9 @@ var gadjo_js = gadjo_js || {}; $content.dialog('option', 'buttons', buttons); /* focus initial input field */ - if ($form.find('input:visible').length) { - $form.find('input:visible')[0].focus(); + var $form_fields = $form.find('input:visible, textarea:visible, select:visible'); + if ($form_fields.length) { + $form_fields[0].focus(); } /* if received content was in json, apply jQuery Form plugin on it */