Skip to content

Commit

Permalink
fix(InputGroup): add ariaLabel prop in cloneElement function
Browse files Browse the repository at this point in the history
  • Loading branch information
sarkaaa committed Dec 17, 2024
1 parent 10f999c commit 1f7a5f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/orbit-components/src/InputGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import * as React from "react";
import cx from "clsx";

import type { Props } from "./types";
import type { Props as InputFieldProps } from "../InputField/types";
import type { Props as SelectProps } from "../Select/types";
import FormLabel from "../FormLabel";
import ErrorFormTooltip from "../ErrorFormTooltip";
import useRandomId, { useRandomIdSeed } from "../hooks/useRandomId";
Expand Down Expand Up @@ -135,7 +137,8 @@ const InputGroup = React.forwardRef<HTMLDivElement, Props>(
Array.isArray(flex) && flex.length !== 1 ? flex[key] ?? flex[0] : flex
) as string | undefined;

const item = child as React.ReactElement<Props>;
const item = child as React.ReactElement<InputFieldProps | SelectProps>;

return (
<div
key={randomId(String(key))}
Expand All @@ -158,7 +161,7 @@ const InputGroup = React.forwardRef<HTMLDivElement, Props>(
onChange: handleChange(item.props.onChange),
onBlur: handleBlur(item.props.onBlur),
onFocus: handleFocus(item.props.onFocus),
// @ts-expect-error custom prop
ariaLabel: item.props.label as string,
insideInputGroup: true,
})}
</div>
Expand Down

0 comments on commit 1f7a5f6

Please sign in to comment.