set autofocus attribute on form fields for better keyboard support (#640)

This commit is contained in:
Kevin Papst
2019-03-13 00:09:02 +01:00
committed by GitHub
parent f4d53e9006
commit 19bfff9899
8 changed files with 23 additions and 3 deletions

View File

@@ -252,6 +252,11 @@ $(function() {
$modal.modal({ backdrop : false });
// -----------------------------------------------------------------------
// workaround for autofocus attribute, as the modal "steals" it
$modal.on('shown.bs.modal', function () {
$(this).find('input:visible:first').focus().delay(1000).focus();
});
$modal.modal('show');
// the new form that was loaded via ajax

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
{
"build/app.js": "./app.js?2adac3fa8d223ed843ed",
"build/app.js": "./app.js?6b33d608a88c93cb8dbc",
"build/app.css": "./app.css?d1c5aa3942706f7bffb181e234e112de",
"build/images/blue@2x.png": "./images/blue@2x.png?2694acfd",
"build/images/blue.png": "./images/blue.png?96f8a905",

View File

@@ -52,6 +52,9 @@ class ActivityEditForm extends AbstractType
// string - length 255
->add('name', TextType::class, [
'label' => 'label.name',
'attr' => [
'autofocus' => 'autofocus'
],
])
// text
->add('comment', TextareaType::class, [

View File

@@ -40,6 +40,9 @@ class CustomerEditForm extends AbstractType
$builder
->add('name', TextType::class, [
'label' => 'label.name',
'attr' => [
'autofocus' => 'autofocus'
],
])
->add('number', TextType::class, [
'label' => 'label.number',

View File

@@ -46,6 +46,9 @@ class ProjectEditForm extends AbstractType
$builder
->add('name', TextType::class, [
'label' => 'label.name',
'attr' => [
'autofocus' => 'autofocus'
],
])
->add('comment', TextareaType::class, [
'label' => 'label.comment',

View File

@@ -111,6 +111,9 @@ class TimesheetEditForm extends AbstractType
'label' => 'label.begin',
'model_timezone' => $timezone,
'view_timezone' => $timezone,
'attr' => [
'autofocus' => 'autofocus',
],
]);
}

View File

@@ -28,7 +28,10 @@ class UserCreateType extends UserEditType
$builder
->add('username', null, [
'label' => 'label.username',
'required' => true
'required' => true,
'attr' => [
'autofocus' => 'autofocus'
],
])
->add('plainPassword', RepeatedType::class, [
'required' => true,