Skip to content

Commit 08925b7

Browse files
committed
Fix Checkbox
1 parent 1929a55 commit 08925b7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/checkbox/src/Checkbox/Checkbox.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ const Checkbox = React.forwardRef(
137137
className={cx(labelStyle, labelHoverStyle[theme], {
138138
[disabledLabelStyle]: disabled,
139139
})}
140-
data-lgid={lgIds.root}
141-
data-testid={lgIds.root}
140+
data-lgid={lgIds.label}
141+
data-testid={lgIds.label}
142142
>
143143
<input
144144
{...rest}
@@ -186,8 +186,8 @@ const Checkbox = React.forwardRef(
186186
<Description
187187
className={descriptionStyle}
188188
disabled={disabled}
189-
data-lgid={lgIds.root}
190-
data-testid={lgIds.root}
189+
data-lgid={lgIds.description}
190+
data-testid={lgIds.description}
191191
>
192192
{description}
193193
</Description>

packages/checkbox/src/utils/getLgIds.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { LgIdString } from '@leafygreen-ui/lib';
33
export const DEFAULT_LGID_ROOT = 'lg-checkbox';
44

55
export const getLgIds = (root: LgIdString = DEFAULT_LGID_ROOT) => {
6-
const ids = {
6+
return {
77
root,
8+
label: `${root}-label`,
9+
description: `${root}-description`,
810
} as const;
9-
return ids;
1011
};
1112

1213
export type GetLgIdsReturnType = ReturnType<typeof getLgIds>;

0 commit comments

Comments
 (0)