Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v.0.13.4

### Fixed

- Fixed accessibility issue with credentials view

## v.0.13.3

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mxenabled/connect-widget",
"description": "A simple ui library for React",
"version": "0.13.3",
"version": "0.13.4",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
"type": "module",
Expand Down
27 changes: 25 additions & 2 deletions src/views/credentials/Credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,17 @@ export const Credentials = React.forwardRef(
initialValues,
)

const inputRefs = useRef({})

useEffect(() => {
for (const field of credentials) {
if (errors[field.field_name]) {
inputRefs.current[field.field_name]?.focus()
break
}
}
}, [errors])

function attemptConnect() {
const credentialsPayload = credentials.map((credential) => {
return {
Expand Down Expand Up @@ -444,7 +455,13 @@ export const Credentials = React.forwardRef(
errors[field.field_name]
}
id={field.field_name}
inputProps={{ 'aria-label': field.label }}
inputProps={{
'aria-label': field.label,
'aria-describedby': errors[field.field_name]
? `${field.field_name}-error`
: undefined,
}}
inputRef={(el) => (inputRefs.current[field.field_name] = el)}
label={field.label}
name={field.field_name}
onBlur={handleBlur}
Expand All @@ -469,7 +486,13 @@ export const Credentials = React.forwardRef(
fullWidth={true}
helperText={errors[field.field_name]}
id={field.field_name}
inputProps={{ 'aria-label': __('Enter your %1', field.label) }}
inputProps={{
'aria-label': __('Enter your %1', field.label),
'aria-describedby': errors[field.field_name]
? `${field.field_name}-error`
: undefined,
}}
inputRef={(el) => (inputRefs.current[field.field_name] = el)}
label={field.label}
name={field.field_name}
onChange={handleUserNameTextChange}
Expand Down