Skip to content

Commit

Permalink
blur file input (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinShetty authored Feb 3, 2025
1 parent 017e64c commit f15a305
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/GraphLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ function GraphLoader({ onGraphChange }: GraphLoaderProps) {
newValue.text().then((text) => {
const g = new Graph(text);
onGraphChange(g);
// Blur (remove focus from) the file input
if (document.activeElement instanceof HTMLElement) {
document.activeElement.blur();
}
});
}

Expand Down
4 changes: 4 additions & 0 deletions src/SolutionLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ function SolutionLoader({ onSolutionChange }: SolutionLoaderProps) {
if (newValue) {
newValue.text().then((text) => {
onSolutionChange(parseSolution(text));
// Blur (remove focus from) the file input
if (document.activeElement instanceof HTMLElement) {
document.activeElement.blur();
}
});
}
}
Expand Down

0 comments on commit f15a305

Please sign in to comment.