Skip to content

Commit 07329e0

Browse files
committed
feat(InputGroup): add ariaLabel and ariaLabelledby props
1 parent 9da606e commit 07329e0

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

packages/orbit-components/src/InputGroup/README.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,22 @@ After adding import into your project you can use it simply like:
2121

2222
Table below contains all types of the props available in InputGroup component.
2323

24-
| Name | Type | Default | Description |
25-
| :----------- | :-------------------------- | :----------- | :------------------------------------------------------------------------------------------------------------------ |
26-
| **children** | `React.Node` | | The content of the InputGroup, normally **InputField** or **Select**. |
27-
| dataTest | `string` | | Optional prop for testing purposes. |
28-
| id | `string` | | Set `id` for `InputGroup` |
29-
| error | `React.Node` | | The error to display beneath the InputGroup. [See Functional specs](#functional-specs) |
30-
| disabled | `boolean` | | Whether to disable all nested fields. |
31-
| flex | `string` or `Array<string>` | `"0 1 auto"` | The flex attribute(s) for children of the InputGroup. [See Functional specs](#functional-specs) |
32-
| label | `Translation` | | The label for the InputGroup. [See Functional specs](#functional-specs) |
33-
| onChange | `event => void \| Promise` | | Function for handling onClick event. [See Functional specs](#functional-specs) |
34-
| onFocus | `event => void \| Promise` | | Function for handling onFocus event. [See Functional specs](#functional-specs) |
35-
| onBlur | `event => void \| Promise` | | Function for handling onBlur event between different InputGroup children. [See Functional specs](#functional-specs) |
36-
| onBlurGroup | `event => void \| Promise` | | Function for handling onBlur event for the whole InputGroup. [See Functional specs](#functional-specs) |
37-
| spaceAfter | `enum` | | Additional `margin-bottom` after component. |
24+
| Name | Type | Default | Description |
25+
| :------------- | :-------------------------- | :----------- | :------------------------------------------------------------------------------------------------------------------ |
26+
| **children** | `React.Node` | | The content of the InputGroup, normally **InputField** or **Select**. |
27+
| dataTest | `string` | | Optional prop for testing purposes. |
28+
| id | `string` | | Set `id` for `InputGroup` |
29+
| error | `React.Node` | | The error to display beneath the InputGroup. [See Functional specs](#functional-specs) |
30+
| disabled | `boolean` | | Whether to disable all nested fields. |
31+
| flex | `string` or `Array<string>` | `"0 1 auto"` | The flex attribute(s) for children of the InputGroup. [See Functional specs](#functional-specs) |
32+
| label | `Translation` | | The label for the InputGroup. [See Functional specs](#functional-specs) |
33+
| onChange | `event => void \| Promise` | | Function for handling onClick event. [See Functional specs](#functional-specs) |
34+
| onFocus | `event => void \| Promise` | | Function for handling onFocus event. [See Functional specs](#functional-specs) |
35+
| onBlur | `event => void \| Promise` | | Function for handling onBlur event between different InputGroup children. [See Functional specs](#functional-specs) |
36+
| onBlurGroup | `event => void \| Promise` | | Function for handling onBlur event for the whole InputGroup. [See Functional specs](#functional-specs) |
37+
| spaceAfter | `enum` | | Additional `margin-bottom` after component. |
38+
| ariaLabel | `string` | | Optional prop for `aria-label` value. |
39+
| ariaLabelledby | `string` | | Optional prop for `aria-labelledby` value. |
3840

3941
### enum
4042

packages/orbit-components/src/InputGroup/index.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const InputGroup = React.forwardRef<HTMLFieldSetElement, Props>(
3434
onBlur,
3535
onChange,
3636
onBlurGroup,
37+
ariaLabel,
38+
ariaLabelledby,
3739
},
3840
ref,
3941
) => {
@@ -105,6 +107,8 @@ const InputGroup = React.forwardRef<HTMLFieldSetElement, Props>(
105107
id={id}
106108
data-test={dataTest}
107109
data-state={getFieldDataState(!!errorReal)}
110+
aria-label={ariaLabel}
111+
aria-labelledby={ariaLabelledby}
108112
>
109113
{label && (
110114
<legend>

packages/orbit-components/src/InputGroup/types.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ export interface Props extends Common.Globals, Common.SpaceAfter {
2222
readonly onBlur?: React.FocusEventHandler<
2323
HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
2424
>;
25+
readonly ariaLabel?: string;
26+
readonly ariaLabelledby?: string;
2527
}

0 commit comments

Comments
 (0)