Skip to content

Commit

Permalink
Fixes for double event bug
Browse files Browse the repository at this point in the history
  • Loading branch information
beganovich committed Oct 31, 2024
1 parent e010105 commit 7fa82c2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,15 @@ export function AURegions() {
>
<div
className="flex col-span-1 items-center justify-start pl-5"
onClick={() =>
onClick={(e) => {
if (e.target instanceof HTMLInputElement) {
return;
}

divClickIntercept(
`tax_data.regions.AU.subregions.${value[0]}.apply_tax`
)
}
);
}}
>
<Checkbox
id={`tax_data.regions.AU.subregions.${value[0]}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export function EURegions() {
};

const divClickIntercept = (id: string) => {
console.log(id);

const checkbox = document.getElementById(id.replace('.apply_tax', ''));
checkbox?.click();
};
Expand Down Expand Up @@ -95,15 +97,19 @@ export function EURegions() {
regions?.map((value: [string, TaxSetting], index) => (
<div
key={index}
className="border py-4 sm:py-3 sm:grid sm:grid-cols-3 sm:gap-10 flex flex-col lg:flex-row undefined px-5 sm:px-6 lg:items-center"
className="border py-4 sm:py-3 sm:grid sm:grid-cols-3 sm:gap-10 flex flex-col lg:flex-row undefined px-5 sm:px-6 lg:items-center text-sm"
>
<div
className="flex col-span-1 items-center justify-start pl-5"
onClick={() =>
onClick={(e) => {
if (e.target instanceof HTMLInputElement) {
return;
}

divClickIntercept(
`tax_data.regions.EU.subregions.${value[0]}.apply_tax`
)
}
);
}}
>
<Checkbox
id={`tax_data.regions.EU.subregions.${value[0]}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,15 @@ export function USRegions() {
>
<div
className="flex col-span-1 items-center justify-start pl-5"
onClick={() =>
onClick={(e) => {
if (e.target instanceof HTMLInputElement) {
return;
}

divClickIntercept(
`tax_data.regions.US.subregions.${value[0]}.apply_tax`
)
}
);
}}
>
<Checkbox
id={`tax_data.regions.US.subregions.${value[0]}`}
Expand Down

0 comments on commit 7fa82c2

Please sign in to comment.