Skip to content

Commit bbcf958

Browse files
Waldleufergeorg-schwarz
authored andcommitted
fix(molecules): prevent TwoWaySelection layout jump on interaction
1 parent 66594ef commit bbcf958

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/components/molecules/TwoWaySelection/TwoWaySelection.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const TwoWaySelection = ({
7272
<div className="mt-4 grid gap-3 sm:grid-cols-2">
7373
<label
7474
className={[
75-
"cursor-pointer rounded-lg border px-4 py-3 text-sm font-medium transition-colors",
75+
"relative cursor-pointer rounded-lg border px-4 py-3 text-sm font-medium transition-colors",
7676
selectedSide === "left"
7777
? "border-primary-500 bg-primary-50 text-primary-800"
7878
: "border-secondary-200 text-secondary-800 hover:border-primary-300",
@@ -82,7 +82,7 @@ export const TwoWaySelection = ({
8282
type="radio"
8383
name={fieldName}
8484
value="left"
85-
className="sr-only"
85+
className="absolute inset-0 h-full w-full cursor-pointer opacity-0"
8686
checked={selectedSide === "left"}
8787
onChange={() => setSelectedSide("left")}
8888
/>
@@ -91,7 +91,7 @@ export const TwoWaySelection = ({
9191

9292
<label
9393
className={[
94-
"cursor-pointer rounded-lg border px-4 py-3 text-sm font-medium transition-colors",
94+
"relative cursor-pointer rounded-lg border px-4 py-3 text-sm font-medium transition-colors",
9595
selectedSide === "right"
9696
? "border-primary-500 bg-primary-50 text-primary-800"
9797
: "border-secondary-200 text-secondary-800 hover:border-primary-300",
@@ -101,7 +101,7 @@ export const TwoWaySelection = ({
101101
type="radio"
102102
name={fieldName}
103103
value="right"
104-
className="sr-only"
104+
className="absolute inset-0 h-full w-full cursor-pointer opacity-0"
105105
checked={selectedSide === "right"}
106106
onChange={() => setSelectedSide("right")}
107107
/>

0 commit comments

Comments
 (0)