Skip to content

Commit

Permalink
feat(Select): add ariaLabel prop
Browse files Browse the repository at this point in the history
  • Loading branch information
sarkaaa committed Dec 6, 2024
1 parent e64f49f commit 8d86f8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/orbit-components/src/Select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const Select = React.forwardRef<HTMLSelectElement, Props>((props, ref) => {
customValueText,
insideInputGroup,
dataAttrs,
ariaLabel,
} = props;
const filled = !(value == null || value === "");

Expand Down Expand Up @@ -67,6 +68,7 @@ const Select = React.forwardRef<HTMLSelectElement, Props>((props, ref) => {
className={cx("relative block", spaceAfter && spaceAfterClasses[spaceAfter])}
ref={inputRef}
style={{ width }}
aria-label={label?.toString() || ariaLabel?.toString()}
>
{label && !inlineLabel && (
<FormLabel
Expand Down Expand Up @@ -167,7 +169,6 @@ const Select = React.forwardRef<HTMLSelectElement, Props>((props, ref) => {
onBlur={onBlur}
onChange={onChange}
tabIndex={tabIndex ? Number(tabIndex) : undefined}
id={selectId}
required={required}
ref={ref}
aria-describedby={shown ? `${selectId}-feedback` : undefined}
Expand Down
1 change: 1 addition & 0 deletions packages/orbit-components/src/Select/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ export interface Props extends Common.Globals, Common.SpaceAfter, Common.DataAtt
readonly insideInputGroup?: boolean;
readonly inlineLabel?: boolean;
readonly customValueText?: Common.Translation;
readonly ariaLabel?: Common.Translation;
}

0 comments on commit 8d86f8e

Please sign in to comment.