From f700f8e1507ea67fd7ea4c0872bf7974bcc5bdd4 Mon Sep 17 00:00:00 2001 From: Pavan G M Date: Fri, 11 Feb 2022 14:40:46 +0530 Subject: [PATCH 1/4] added aria-describedby label --- src/AvField.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AvField.js b/src/AvField.js index 78a76fa..9aac2f7 100644 --- a/src/AvField.js +++ b/src/AvField.js @@ -89,14 +89,14 @@ export default class AvField extends Component { size={size} disabled={disabled} readOnly={readOnly} - {...attributes} + {...attributes, {'aria-describedby':'errorMsg'}} > {children} ); const validation = this.context.FormCtrl.getInputState(this.props.name); - const feedback = validation.errorMessage ? ({validation.errorMessage}) : null; + const feedback = validation.errorMessage ? ({validation.errorMessage}) : null; const help = helpMessage ? ({helpMessage}) : null; const inputRow = row ? {input}{feedback}{help} : input; const check = attributes.type === 'checkbox'; From 76514a5305860846e32cc4fca35d3cd5bf23c8b7 Mon Sep 17 00:00:00 2001 From: Pavan G M Date: Fri, 11 Feb 2022 20:03:58 +0530 Subject: [PATCH 2/4] updated the attributes with aria-describedby --- src/AvField.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AvField.js b/src/AvField.js index 9aac2f7..da799c8 100644 --- a/src/AvField.js +++ b/src/AvField.js @@ -89,7 +89,7 @@ export default class AvField extends Component { size={size} disabled={disabled} readOnly={readOnly} - {...attributes, {'aria-describedby':'errorMsg'}} + {...{...attributes, ...{'aria-describedby':'errorMsg'}}} > {children} ); From 46b4b357713f61095e29d3855c9774cadd39726a Mon Sep 17 00:00:00 2001 From: Pavan G M Date: Fri, 11 Feb 2022 20:59:42 +0530 Subject: [PATCH 3/4] Addressed review comments --- src/AvField.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/AvField.js b/src/AvField.js index da799c8..b6506b6 100644 --- a/src/AvField.js +++ b/src/AvField.js @@ -89,14 +89,15 @@ export default class AvField extends Component { size={size} disabled={disabled} readOnly={readOnly} - {...{...attributes, ...{'aria-describedby':'errorMsg'}}} + aria-describedby = {`${id}-error`} + {...attributes} > {children} ); const validation = this.context.FormCtrl.getInputState(this.props.name); - const feedback = validation.errorMessage ? ({validation.errorMessage}) : null; + const feedback = validation.errorMessage ? ({validation.errorMessage}) : null; const help = helpMessage ? ({helpMessage}) : null; const inputRow = row ? {input}{feedback}{help} : input; const check = attributes.type === 'checkbox'; From 62a672d065a39f6cc01ba805458541a389ffb725 Mon Sep 17 00:00:00 2001 From: Pavan G M Date: Fri, 11 Feb 2022 21:28:31 +0530 Subject: [PATCH 4/4] added condition for aria-describedby --- src/AvField.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AvField.js b/src/AvField.js index b6506b6..dbe2c88 100644 --- a/src/AvField.js +++ b/src/AvField.js @@ -89,7 +89,7 @@ export default class AvField extends Component { size={size} disabled={disabled} readOnly={readOnly} - aria-describedby = {`${id}-error`} + aria-describedby={validation.errorMessage ? `${id}-error` : undefined} {...attributes} > {children}