Skip to content

Commit

Permalink
fix(operatorSelection): fix Enter/Go key with <form> (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathcolo authored Oct 28, 2024
1 parent 8457738 commit 8ca4828
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions js/components/operatorSignIn/operatorSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,17 @@ export const OperatorSelection = ({
const buttonEnabled = badgeEntry !== null;

return (
<div className="flex flex-col content-stretch">
<form
className="flex flex-col content-stretch"
onSubmit={(e) => {
e.preventDefault();
if (badgeEntry === null) {
throw new Error("operatorSelection badgeEntry was impossibly null.");
}

onOK(badgeEntry);
}}
>
{nfcSupported ?
<NfcSupported />
: <NfcUnsupported />}
Expand All @@ -62,24 +72,14 @@ export const OperatorSelection = ({
/>
<button
disabled={!buttonEnabled}
onClick={() => {
// This should never happen, but throw just in case.
if (badgeEntry === null) {
throw new Error(
"operatorSelection badgeEntry was impossibly null.",
);
}

onOK(badgeEntry);
}}
className={className([
"rounded bg-gray-500 text-gray-200 mt-3 w-full md:max-w-64 mx-auto h-10",
!buttonEnabled && "opacity-50",
])}
>
OK
</button>
</div>
</form>
);
};

Expand Down

0 comments on commit 8ca4828

Please sign in to comment.