Skip to content

Commit 5e13c9e

Browse files
committed
nativeSelectProps?.id as selectIdExplicitelyProvided
1 parent 24e743b commit 5e13c9e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Select.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ const SelectComponent = <T extends GenericOption<DefaultOptionValue>[]>(
6161
} = props;
6262

6363
assert<Equals<keyof typeof rest, never>>();
64-
64+
const selectIdExplicitelyProvided = nativeSelectProps?.id;
6565
const { selectId, stateDescriptionId } = (function useClosure() {
6666
const elementId = useId();
67-
const selectId = nativeSelectProps?.id ?? `select-${elementId}`;
68-
const stateDescriptionId = nativeSelectProps?.id
69-
? `${nativeSelectProps?.id}-desc`
67+
const selectId = selectIdExplicitelyProvided ?? `select-${elementId}`;
68+
const stateDescriptionId = selectIdExplicitelyProvided
69+
? `${selectIdExplicitelyProvided}-desc`
7070
: `select-${elementId}-desc`;
7171

7272
return { selectId, stateDescriptionId };

0 commit comments

Comments
 (0)