Skip to content

Commit

Permalink
Scroll down when image selection fails
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Mar 16, 2024
1 parent d2c7b6f commit be86e7d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/image-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export function ImageSelector({
);

setMessages((prevMessages) => [...prevMessages, message]);
document.body.scrollIntoView({block: `end`, behavior: `smooth`});
} catch (error) {
console.error(error);
const errorMessage = getErrorMessage(error);
Expand All @@ -33,6 +32,8 @@ export function ImageSelector({
{id: Date.now(), role: `error`, display: <p>{errorMessage}</p>},
]);
}

document.body.scrollIntoView({block: `end`, behavior: `smooth`});
};

return <button formAction={formAction}>{children}</button>;
Expand Down

0 comments on commit be86e7d

Please sign in to comment.