summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2023-09-07 09:59:35 +1000
committerJake Mannens <jake@asger.xyz>2023-09-07 09:59:35 +1000
commit17b6539796f0ed4ce23da2e88d0f520959908606 (patch)
tree834896fa2d40c8c278d438ed7e34b33e096399d0
parent85e718f94d4dd9ed539de82971710f117566b740 (diff)
Implemented a slightly better fix for focusing input dialogs
-rw-r--r--Pages/Component/TagSelectDialog.razor5
-rw-r--r--wwwroot/js/dialog.js5
2 files changed, 5 insertions, 5 deletions
diff --git a/Pages/Component/TagSelectDialog.razor b/Pages/Component/TagSelectDialog.razor
index 88e1471..7be5c43 100644
--- a/Pages/Component/TagSelectDialog.razor
+++ b/Pages/Component/TagSelectDialog.razor
@@ -75,11 +75,6 @@
LoadTags();
}
- protected override async Task OnAfterRenderAsync(bool firstRender) {
- if(Visible)
- await Task.Delay(100).ContinueWith(t => queryInput.FocusAsync());
- }
-
private void LoadTags() {
db = dbFactory.CreateDbContext();
diff --git a/wwwroot/js/dialog.js b/wwwroot/js/dialog.js
index 7ea141e..065014a 100644
--- a/wwwroot/js/dialog.js
+++ b/wwwroot/js/dialog.js
@@ -41,6 +41,11 @@ function setDialogVisibility(element, visible) {
element.style.opacity = 1;
element.style.visibility = 'visible';
bumpDialog(element);
+
+ var input = element.querySelector('input[type="text"]');
+ if(input) {
+ setTimeout(() => input.focus(), 100);
+ }
} else {
element.style.opacity = 0;
element.style.visibility = 'hidden';