diff --git a/public/viewjs/barcodescannertesting.js b/public/viewjs/barcodescannertesting.js index 8f095020..7c7dd6a5 100644 --- a/public/viewjs/barcodescannertesting.js +++ b/public/viewjs/barcodescannertesting.js @@ -31,11 +31,11 @@ $("#expected_barcode").on("keyup", function(e) } }); -$("#expected_barcode").focus(); setTimeout(function() { $("#barcodescanner-start-button").attr("disabled", ""); $("#barcodescanner-start-button").addClass("disabled"); + $("#expected_barcode").focus(); }, 500); if (GetUriParam("barcode") !== undefined) diff --git a/public/viewjs/batterytracking.js b/public/viewjs/batterytracking.js index 8a506362..fff06e77 100644 --- a/public/viewjs/batterytracking.js +++ b/public/viewjs/batterytracking.js @@ -78,11 +78,14 @@ $('.combobox').combobox({ }); $('#battery_id').val(''); -$('#battery_id_text_input').focus(); $('#battery_id_text_input').val(''); $('#battery_id_text_input').trigger('change'); Grocy.Components.DateTimePicker.GetInputElement().trigger('input'); Grocy.FrontendHelpers.ValidateForm('batterytracking-form'); +setTimeout(function() +{ + $('#battery_id_text_input').focus(); +}, 500); $('#batterytracking-form input').keyup(function(event) { diff --git a/public/viewjs/choreform.js b/public/viewjs/choreform.js index 464bd46f..ee9d7c58 100644 --- a/public/viewjs/choreform.js +++ b/public/viewjs/choreform.js @@ -111,8 +111,11 @@ for (var i = 0; i < checkboxValues.length; i++) } Grocy.Components.UserfieldsForm.Load(); -$('#name').focus(); Grocy.FrontendHelpers.ValidateForm('chore-form'); +setTimeout(function() +{ + $('#name').focus(); +}, 500); if (Grocy.EditMode == "edit") { diff --git a/public/viewjs/choretracking.js b/public/viewjs/choretracking.js index 1faf9d21..e01fc70a 100644 --- a/public/viewjs/choretracking.js +++ b/public/viewjs/choretracking.js @@ -111,10 +111,13 @@ $('.combobox').combobox({ clearIfNoMatch: false }); -$('#chore_id_text_input').focus(); $('#chore_id_text_input').trigger('change'); Grocy.Components.DateTimePicker.GetInputElement().trigger('input'); Grocy.FrontendHelpers.ValidateForm('choretracking-form'); +setTimeout(function() +{ + $('#chore_id_text_input').focus(); +}, 500); $('#choretracking-form input').keyup(function(event) { diff --git a/public/viewjs/consume.js b/public/viewjs/consume.js index a53b8d95..84c725ce 100644 --- a/public/viewjs/consume.js +++ b/public/viewjs/consume.js @@ -661,7 +661,10 @@ if (GetUriParam("embedded") !== undefined) } // Default input field -Grocy.Components.ProductPicker.GetInputElement().focus(); +setTimeout(function() +{ + Grocy.Components.ProductPicker.GetInputElement().focus(); +}, 500); $(document).on("change", "#scan-mode", function(e) { diff --git a/public/viewjs/equipmentform.js b/public/viewjs/equipmentform.js index 6675a5c6..ee050c5f 100644 --- a/public/viewjs/equipmentform.js +++ b/public/viewjs/equipmentform.js @@ -146,8 +146,11 @@ $('#delete-current-instruction-manual-button').on('click', function(e) ResizeResponsiveEmbeds(); Grocy.Components.UserfieldsForm.Load(); -$('#name').focus(); Grocy.FrontendHelpers.ValidateForm('equipment-form'); +setTimeout(function() +{ + $('#name').focus(); +}, 500); $("#instruction-manual").on("change", function(e) { diff --git a/public/viewjs/inventory.js b/public/viewjs/inventory.js index 9d876b0d..fc1eb540 100644 --- a/public/viewjs/inventory.js +++ b/public/viewjs/inventory.js @@ -357,7 +357,11 @@ Grocy.FrontendHelpers.ValidateForm('inventory-form'); if (Grocy.Components.ProductPicker.InAnyFlow() === false && GetUriParam("embedded") === undefined) { - Grocy.Components.ProductPicker.GetInputElement().focus(); + setTimeout(function() + { + Grocy.Components.ProductPicker.GetInputElement().focus(); + + }, 500); } else { @@ -365,7 +369,11 @@ else if (Grocy.Components.ProductPicker.InProductModifyWorkflow()) { - Grocy.Components.ProductPicker.GetInputElement().focus(); + setTimeout(function() + { + Grocy.Components.ProductPicker.GetInputElement().focus(); + + }, 500); } } @@ -373,7 +381,11 @@ $('#display_amount').on('focus', function(e) { if (Grocy.Components.ProductPicker.GetValue().length === 0) { - Grocy.Components.ProductPicker.GetInputElement().focus(); + setTimeout(function() + { + Grocy.Components.ProductPicker.GetInputElement().focus(); + + }, 500); } else { diff --git a/public/viewjs/login.js b/public/viewjs/login.js index 8d2e7f6c..dfd8c7c9 100644 --- a/public/viewjs/login.js +++ b/public/viewjs/login.js @@ -1,4 +1,7 @@ -$('#username').focus(); +setTimeout(function() +{ + $('#username').focus(); +}, 500); if (GetUriParam('invalid') === 'true') { diff --git a/public/viewjs/manageapikeys.js b/public/viewjs/manageapikeys.js index 409d047a..ad5feb5c 100644 --- a/public/viewjs/manageapikeys.js +++ b/public/viewjs/manageapikeys.js @@ -96,7 +96,10 @@ $("#add-api-key-button").on("click", function(e) $("#add-api-key-modal").on("shown.bs.modal", function(e) { - $("#description").focus(); + setTimeout(function() + { + $("#description").focus(); + }, 500); }); $("#new-api-key-button").on("click", function(e) diff --git a/public/viewjs/mealplansectionform.js b/public/viewjs/mealplansectionform.js index 4f8661a3..3113c0d5 100644 --- a/public/viewjs/mealplansectionform.js +++ b/public/viewjs/mealplansectionform.js @@ -77,4 +77,7 @@ $('#mealplansection-form input').keydown(function(event) }); Grocy.FrontendHelpers.ValidateForm('mealplansection-form'); -$('#name').focus(); +setTimeout(function() +{ + $('#name').focus(); +}, 500); diff --git a/public/viewjs/productform.js b/public/viewjs/productform.js index 5a4a1239..cbf89823 100644 --- a/public/viewjs/productform.js +++ b/public/viewjs/productform.js @@ -142,7 +142,6 @@ $('.save-product-button').on('click', function(e) if (GetUriParam("flow") == "InplaceNewProductWithName") { $('#name').val(GetUriParam("name")); - $('#name').focus(); } if (GetUriParam("flow") !== undefined || GetUriParam("returnto") !== undefined) @@ -258,9 +257,12 @@ barcodeTable.columns.adjust().draw(); Grocy.Components.UserfieldsForm.Load(); $("#name").trigger("keyup"); -$('#name').focus(); $('.input-group-qu').trigger('change'); Grocy.FrontendHelpers.ValidateForm('product-form'); +setTimeout(function() +{ + $('#name').focus(); +}, 500); $(document).on('click', '.product-grocycode-label-print', function(e) { diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js index 072d6c33..4b7893d1 100644 --- a/public/viewjs/purchase.js +++ b/public/viewjs/purchase.js @@ -489,7 +489,10 @@ if (Grocy.Components.ProductPicker) { if (Grocy.Components.ProductPicker.InAnyFlow() === false && GetUriParam("embedded") === undefined) { - Grocy.Components.ProductPicker.GetInputElement().focus(); + setTimeout(function() + { + Grocy.Components.ProductPicker.GetInputElement().focus(); + }, 500); } else { @@ -497,7 +500,10 @@ if (Grocy.Components.ProductPicker) if (Grocy.Components.ProductPicker.InProductModifyWorkflow()) { - Grocy.Components.ProductPicker.GetInputElement().focus(); + setTimeout(function() + { + Grocy.Components.ProductPicker.GetInputElement().focus(); + }, 500); } } } @@ -506,7 +512,10 @@ $('#display_amount').on('focus', function(e) { if (Grocy.Components.ProductPicker.GetValue().length === 0) { - Grocy.Components.ProductPicker.GetInputElement().focus(); + setTimeout(function() + { + Grocy.Components.ProductPicker.GetInputElement().focus(); + }, 500); } else { diff --git a/public/viewjs/quantityunitconversionform.js b/public/viewjs/quantityunitconversionform.js index 99b69191..d81d7436 100644 --- a/public/viewjs/quantityunitconversionform.js +++ b/public/viewjs/quantityunitconversionform.js @@ -141,8 +141,11 @@ $('.input-group-qu').on('change', function(e) Grocy.Components.UserfieldsForm.Load(); $('.input-group-qu').trigger('change'); -$('#from_qu_id').focus(); Grocy.FrontendHelpers.ValidateForm('quconversion-form'); +setTimeout(function() +{ + $('#from_qu_id').focus(); +}, 500); if (GetUriParam("qu-unit") !== undefined) { diff --git a/public/viewjs/quantityunitform.js b/public/viewjs/quantityunitform.js index 4f037eb8..14aacab3 100644 --- a/public/viewjs/quantityunitform.js +++ b/public/viewjs/quantityunitform.js @@ -151,8 +151,11 @@ quConversionsTable.columns.adjust().draw(); Grocy.Components.UserfieldsForm.Load(); $("#name").trigger("keyup"); -$('#name').focus(); Grocy.FrontendHelpers.ValidateForm('quantityunit-form'); +setTimeout(function() +{ + $('#name').focus(); +}, 500); $(document).on('click', '.qu-conversion-delete-button', function(e) { diff --git a/public/viewjs/quantityunitpluraltesting.js b/public/viewjs/quantityunitpluraltesting.js index c5169ce8..9cd04449 100644 --- a/public/viewjs/quantityunitpluraltesting.js +++ b/public/viewjs/quantityunitpluraltesting.js @@ -34,4 +34,7 @@ if (GetUriParam("qu") !== undefined) $("#qu_id").trigger("change"); } -$("#amount").focus(); +setTimeout(function() +{ + $("#amount").focus(); +}, 500); diff --git a/public/viewjs/recipeform.js b/public/viewjs/recipeform.js index 99335522..0aede261 100644 --- a/public/viewjs/recipeform.js +++ b/public/viewjs/recipeform.js @@ -106,7 +106,10 @@ $('#recipes-includes-table tbody').removeClass("d-none"); recipesIncludesTables.columns.adjust().draw(); Grocy.FrontendHelpers.ValidateForm('recipe-form'); -$("#name").focus(); +setTimeout(function() +{ + $("#name").focus(); +}, 500); $('#recipe-form input').keyup(function(event) { diff --git a/public/viewjs/recipeposform.js b/public/viewjs/recipeposform.js index e36cd19d..417e8c46 100644 --- a/public/viewjs/recipeposform.js +++ b/public/viewjs/recipeposform.js @@ -156,7 +156,10 @@ $('#display_amount').on('focus', function(e) { if (Grocy.Components.ProductPicker.GetValue().length === 0) { - Grocy.Components.ProductPicker.GetInputElement().focus(); + setTimeout(function() + { + Grocy.Components.ProductPicker.GetInputElement().focus(); + }, 500); } else { diff --git a/public/viewjs/shoppinglistitemform.js b/public/viewjs/shoppinglistitemform.js index 1560b049..314641a6 100644 --- a/public/viewjs/shoppinglistitemform.js +++ b/public/viewjs/shoppinglistitemform.js @@ -292,7 +292,7 @@ if (!Grocy.Components.ProductPicker.InAnyFlow()) setTimeout(function() { $("#display_amount").focus(); - }, 300); + }, 500); } else { diff --git a/public/viewjs/transfer.js b/public/viewjs/transfer.js index 0f51d0c3..35fc9c6c 100644 --- a/public/viewjs/transfer.js +++ b/public/viewjs/transfer.js @@ -518,7 +518,10 @@ if (GetUriParam("embedded") !== undefined) if (typeof locationId === 'undefined') { Grocy.Components.ProductPicker.GetPicker().trigger('change'); - Grocy.Components.ProductPicker.GetInputElement().focus(); + setTimeout(function() + { + Grocy.Components.ProductPicker.GetInputElement().focus(); + }, 500); } else { @@ -532,4 +535,7 @@ if (GetUriParam("embedded") !== undefined) } // Default input field -Grocy.Components.ProductPicker.GetInputElement().focus(); +setTimeout(function() +{ + Grocy.Components.ProductPicker.GetInputElement().focus(); +}, 500); diff --git a/public/viewjs/userentityform.js b/public/viewjs/userentityform.js index b0ca4984..a83a8a48 100644 --- a/public/viewjs/userentityform.js +++ b/public/viewjs/userentityform.js @@ -100,11 +100,11 @@ $("#show_in_sidebar_menu").on("click", function() } }); +Grocy.FrontendHelpers.ValidateForm('userentity-form'); setTimeout(function() { $('#name').focus(); }, 500); -Grocy.FrontendHelpers.ValidateForm('userentity-form'); // Click twice to trigger on-click but not change the actual checked state $("#show_in_sidebar_menu").click(); diff --git a/public/viewjs/userfieldform.js b/public/viewjs/userfieldform.js index 1c5ac0fb..6d73bf38 100644 --- a/public/viewjs/userfieldform.js +++ b/public/viewjs/userfieldform.js @@ -122,7 +122,10 @@ if (GetUriParam("entity")) } else { - $('#entity').focus(); + setTimeout(function() + { + $('#entity').focus(); + }, 500); } $("#type").trigger("change"); diff --git a/public/viewjs/userfields.js b/public/viewjs/userfields.js index 7cf472a0..38a4e7f8 100644 --- a/public/viewjs/userfields.js +++ b/public/viewjs/userfields.js @@ -80,5 +80,8 @@ if (GetUriParam("entity")) { $("#entity-filter").val(GetUriParam("entity")); $("#entity-filter").trigger("change"); - $("#name").focus(); + setTimeout(function() + { + $("#name").focus(); + }, 500); } diff --git a/public/viewjs/userform.js b/public/viewjs/userform.js index 771a1fc4..e9ebc493 100644 --- a/public/viewjs/userform.js +++ b/public/viewjs/userform.js @@ -155,7 +155,10 @@ if (GetUriParam("changepw") === "true") } else { - $('#username').focus(); + setTimeout(function() + { + $('#username').focus(); + }, 500); } Grocy.Components.UserfieldsForm.Load(); diff --git a/public/viewjs/userobjectform.js b/public/viewjs/userobjectform.js index ca42ddce..ba4e79b5 100644 --- a/public/viewjs/userobjectform.js +++ b/public/viewjs/userobjectform.js @@ -70,3 +70,8 @@ Grocy.Components.UserfieldsForm.Load(); $("#userfields-form").removeClass("border").removeClass("border-info").removeClass("p-2").find("h2").addClass("d-none"); + +setTimeout(function() +{ + $(".userfield-input").first().focus(); +}, 500);