fix: ensure tag input maintains focus after adding tags [dev]
Some checks failed
Basil CI/CD Pipeline / Code Linting (push) Successful in 1m21s
Basil CI/CD Pipeline / Shared Package Tests (push) Successful in 1m10s
Basil CI/CD Pipeline / Web Tests (push) Successful in 1m40s
Basil CI/CD Pipeline / API Tests (push) Successful in 1m52s
Basil CI/CD Pipeline / Build All Packages (push) Has been cancelled
Basil CI/CD Pipeline / E2E Tests (push) Has been cancelled
Basil CI/CD Pipeline / Build & Push Docker Images (push) Has been cancelled
Basil CI/CD Pipeline / Trigger Deployment (push) Has been cancelled
Basil CI/CD Pipeline / Security Scanning (push) Has been cancelled

- Add focus restoration after recipe state update
- Add focus in finally block to ensure it happens even on error
- Keeps cursor in tag input field for rapid tag entry

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Paul R Kartchner
2026-01-17 00:22:50 -07:00
parent beff2d1b4b
commit 2953bb9f04
3 changed files with 38 additions and 0 deletions

View File

@@ -164,6 +164,8 @@ function RecipeDetail() {
const response = await recipesApi.getById(id);
if (response.data) {
setRecipe(response.data);
// Restore focus after state update
setTimeout(() => tagInputRef.current?.focus(), 0);
}
} catch (err) {
console.error('Failed to add tag:', err);
@@ -172,6 +174,8 @@ function RecipeDetail() {
await loadRecipe(id);
} finally {
setSavingTags(false);
// Ensure focus is maintained
setTimeout(() => tagInputRef.current?.focus(), 0);
}
};

View File

@@ -0,0 +1,14 @@
http:
routers:
basil-dev:
rule: "Host(`localhost`) || Host(`127.0.0.1`)"
entryPoints:
- http
service: basil-dev-service
priority: 1000 # Higher priority than Docker labels (default is 0)
services:
basil-dev-service:
loadBalancer:
servers:
- url: "http://basil-web:80"

20
traefik-local/traefik.yml Normal file
View File

@@ -0,0 +1,20 @@
# Static Traefik configuration for local development
entryPoints:
http:
address: ":80"
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
network: traefik
file:
filename: /dynamic-dev.yml
watch: true
api:
insecure: true
dashboard: true
log:
level: INFO