Fixed modal dialogs / iframes initial input focus (fixes #1665)

This commit is contained in:
Bernd Bestel 2021-11-08 21:59:02 +01:00
parent 29371163ad
commit 286351b6d2
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
10 changed files with 40 additions and 10 deletions

View File

@ -99,5 +99,8 @@ $(document).on('click', '.battery-grocycode-label-print', function(e)
}); });
Grocy.Components.UserfieldsForm.Load(); Grocy.Components.UserfieldsForm.Load();
$('#name').focus(); setTimeout(function()
{
$('#name').focus();
}, 250);
Grocy.FrontendHelpers.ValidateForm('battery-form'); Grocy.FrontendHelpers.ValidateForm('battery-form');

View File

@ -85,4 +85,7 @@ $('#location-form input').keydown(function(event)
Grocy.Components.UserfieldsForm.Load(); Grocy.Components.UserfieldsForm.Load();
Grocy.FrontendHelpers.ValidateForm('location-form'); Grocy.FrontendHelpers.ValidateForm('location-form');
$('#name').focus(); setTimeout(function()
{
$('#name').focus();
}, 250);

View File

@ -91,7 +91,10 @@ if (Grocy.EditMode == "edit")
} }
Grocy.FrontendHelpers.ValidateForm('barcode-form'); Grocy.FrontendHelpers.ValidateForm('barcode-form');
$('#barcode').focus(); setTimeout(function()
{
$('#barcode').focus();
}, 250);
RefreshLocaleNumberInput(); RefreshLocaleNumberInput();
Grocy.Components.UserfieldsForm.Load() Grocy.Components.UserfieldsForm.Load()

View File

@ -70,5 +70,8 @@ $('#product-group-form input').keydown(function(event)
}); });
Grocy.Components.UserfieldsForm.Load(); Grocy.Components.UserfieldsForm.Load();
$('#name').focus(); setTimeout(function()
{
$('#name').focus();
}, 250);
Grocy.FrontendHelpers.ValidateForm('product-group-form'); Grocy.FrontendHelpers.ValidateForm('product-group-form');

View File

@ -74,5 +74,8 @@ $('#shopping-list-form input').keydown(function(event)
}); });
Grocy.Components.UserfieldsForm.Load(); Grocy.Components.UserfieldsForm.Load();
$('#name').focus(); setTimeout(function()
{
$('#name').focus();
}, 250);
Grocy.FrontendHelpers.ValidateForm('shopping-list-form'); Grocy.FrontendHelpers.ValidateForm('shopping-list-form');

View File

@ -209,7 +209,10 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
}); });
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form'); Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
Grocy.Components.ProductPicker.GetInputElement().focus(); setTimeout(function()
{
Grocy.Components.ProductPicker.GetInputElement().focus();
}, 250);
if (Grocy.EditMode === "edit") if (Grocy.EditMode === "edit")
{ {

View File

@ -84,5 +84,8 @@ $('#shoppinglocation-form input').keydown(function(event)
}); });
Grocy.Components.UserfieldsForm.Load(); Grocy.Components.UserfieldsForm.Load();
$('#name').focus(); setTimeout(function()
{
$('#name').focus();
}, 250);
Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form'); Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form');

View File

@ -84,5 +84,8 @@ $('#task-category-form input').keydown(function(event)
}); });
Grocy.Components.UserfieldsForm.Load(); Grocy.Components.UserfieldsForm.Load();
$('#name').focus(); setTimeout(function()
{
$('#name').focus();
}, 250);
Grocy.FrontendHelpers.ValidateForm('task-category-form'); Grocy.FrontendHelpers.ValidateForm('task-category-form');

View File

@ -88,6 +88,9 @@ $('#task-form input').keydown(function(event)
}); });
Grocy.Components.UserfieldsForm.Load(); Grocy.Components.UserfieldsForm.Load();
$('#name').focus(); setTimeout(function()
{
$('#name').focus();
}, 250);
Grocy.Components.DateTimePicker.GetInputElement().trigger('input'); Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
Grocy.FrontendHelpers.ValidateForm('task-form'); Grocy.FrontendHelpers.ValidateForm('task-form');

View File

@ -95,7 +95,10 @@ $("#show_in_sidebar_menu").on("click", function()
} }
}); });
$('#name').focus(); setTimeout(function()
{
$('#name').focus();
}, 250);
Grocy.FrontendHelpers.ValidateForm('userentity-form'); Grocy.FrontendHelpers.ValidateForm('userentity-form');
// Click twice to trigger on-click but not change the actual checked state // Click twice to trigger on-click but not change the actual checked state