From b460268bad4eb4c52e1e630e94e04302f7e70f71 Mon Sep 17 00:00:00 2001 From: Sarka Chwastkova Date: Thu, 12 Dec 2024 16:02:45 +0100 Subject: [PATCH] feat(InputField): add ariaLabel prop --- .../src/InputField/InputField.stories.tsx | 14 ++++++++++++++ packages/orbit-components/src/InputField/index.tsx | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/orbit-components/src/InputField/InputField.stories.tsx b/packages/orbit-components/src/InputField/InputField.stories.tsx index bdb43deb44..c5e53b4f29 100644 --- a/packages/orbit-components/src/InputField/InputField.stories.tsx +++ b/packages/orbit-components/src/InputField/InputField.stories.tsx @@ -499,6 +499,20 @@ export const Playground: Story = { }, }, }, + + parameters: { + controls: { + exclude: [ + "onChange", + "onFocus", + "onBlur", + "onMouseUp", + "onMouseDown", + "onSelect", + "onKeyDown", + ], + }, + }, }; export const Rtl: Story = { diff --git a/packages/orbit-components/src/InputField/index.tsx b/packages/orbit-components/src/InputField/index.tsx index 3678c8e1f7..bd349a7837 100644 --- a/packages/orbit-components/src/InputField/index.tsx +++ b/packages/orbit-components/src/InputField/index.tsx @@ -269,7 +269,7 @@ const InputField = React.forwardRef((props, ref) => { ref={ref} tabIndex={tabIndex !== undefined ? Number(tabIndex) : undefined} list={list} - aria-labelledby={!label ? inputId : undefined} + aria-label={label ? (label as string) : undefined} aria-describedby={shown ? `${inputId}-feedback` : undefined} aria-invalid={error ? true : undefined} aria-autocomplete={ariaAutocomplete}