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
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:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user