From 140b673e64819d7be2718bd781bb9a1dc735ff54 Mon Sep 17 00:00:00 2001 From: Matt Filbert Date: Mon, 9 Nov 2020 09:27:08 -0500 Subject: [PATCH 1/4] added aria label prop and attribute to checkbox --- src/checkbox/checkbox.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/checkbox/checkbox.js b/src/checkbox/checkbox.js index fe14742aaa..cfebedf438 100644 --- a/src/checkbox/checkbox.js +++ b/src/checkbox/checkbox.js @@ -133,6 +133,7 @@ class StatelessCheckbox extends React.Component { children, required, title, + ariaLabel } = this.props; const { @@ -228,6 +229,7 @@ class StatelessCheckbox extends React.Component { name={name} checked={checked} required={required} + aria-label={ariaLabel} aria-checked={isIndeterminate ? 'mixed' : checked} aria-describedby={this.props['aria-describedby']} aria-errormessage={this.props['aria-errormessage']} From ec28cbb90ef5ca90e6f58763fa189f216c87b4cf Mon Sep 17 00:00:00 2001 From: mattcfilbert Date: Tue, 10 Nov 2020 10:32:53 -0500 Subject: [PATCH 2/4] updated doc info and d.ts for aria-label on checkbox --- documentation-site/components/yard/config/checkbox.ts | 6 ++++++ src/checkbox/index.d.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/documentation-site/components/yard/config/checkbox.ts b/documentation-site/components/yard/config/checkbox.ts index 94fe5d8847..1daca1d7ab 100644 --- a/documentation-site/components/yard/config/checkbox.ts +++ b/documentation-site/components/yard/config/checkbox.ts @@ -131,6 +131,12 @@ const CheckboxConfig: TConfig = { description: 'Title attribute.', hidden: true, }, + ariaLabel: { + value: undefined, + type: PropTypes.Sting, + description: 'Aria-label attribute', + hidden: true, + }, ...pick(changeHandlers, [ 'onBlur', 'onFocus', diff --git a/src/checkbox/index.d.ts b/src/checkbox/index.d.ts index 54b2335df0..49cc9b51f0 100644 --- a/src/checkbox/index.d.ts +++ b/src/checkbox/index.d.ts @@ -103,6 +103,7 @@ export interface CheckboxProps { labelPlacement?: 'top' | 'right' | 'bottom' | 'left'; checkmarkType?: STYLE_TYPE[keyof STYLE_TYPE]; title?: string; + ariaLabel?: string; onChange?: React.FormEventHandler; onMouseEnter?: React.MouseEventHandler; onMouseLeave?: React.MouseEventHandler; From adb8d43e078d29f30103ff2b30905d77b4a8818b Mon Sep 17 00:00:00 2001 From: Matt Filbert Date: Wed, 18 Nov 2020 10:37:12 -0500 Subject: [PATCH 3/4] typo fix --- documentation-site/components/yard/config/checkbox.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation-site/components/yard/config/checkbox.ts b/documentation-site/components/yard/config/checkbox.ts index 1daca1d7ab..fc18a2024b 100644 --- a/documentation-site/components/yard/config/checkbox.ts +++ b/documentation-site/components/yard/config/checkbox.ts @@ -133,7 +133,7 @@ const CheckboxConfig: TConfig = { }, ariaLabel: { value: undefined, - type: PropTypes.Sting, + type: PropTypes.String, description: 'Aria-label attribute', hidden: true, }, From e2d0130b79d2eab2b0bbd668c5b6ed25e37dfcb1 Mon Sep 17 00:00:00 2001 From: Matt Filbert Date: Wed, 18 Nov 2020 10:44:14 -0500 Subject: [PATCH 4/4] types update for ariaLabel --- src/checkbox/types.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/checkbox/types.js b/src/checkbox/types.js index aa882b5993..ea628de441 100644 --- a/src/checkbox/types.js +++ b/src/checkbox/types.js @@ -46,6 +46,8 @@ export type PropsT = { 'aria-describedby'?: string, /** Id of element which contains a related error message */ 'aria-errormessage'?: string, + /** Passed to the input element aria-label attribute. */ + ariaLabel?: string, /** Component or String value for label of checkbox. */ children?: React$Node, overrides?: OverridesT,