@mxenabled/connect-widget 0.13.3 → 0.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -70218,6 +70218,15 @@ const Credentials = React__default.forwardRef(
70218
70218
  formSchema,
70219
70219
  initialValues
70220
70220
  );
70221
+ const inputRefs = useRef({});
70222
+ useEffect(() => {
70223
+ for (const field of credentials) {
70224
+ if (errors[field.field_name]) {
70225
+ inputRefs.current[field.field_name]?.focus();
70226
+ break;
70227
+ }
70228
+ }
70229
+ }, [errors]);
70221
70230
  function attemptConnect() {
70222
70231
  const credentialsPayload = credentials.map((credential) => {
70223
70232
  return {
@@ -70393,7 +70402,11 @@ const Credentials = React__default.forwardRef(
70393
70402
  fullWidth: true,
70394
70403
  helperText: validations.isCapsLockOn && __("Caps lock is on") || validations.validateSpaceMessage || errors[field.field_name],
70395
70404
  id: field.field_name,
70396
- inputProps: { "aria-label": field.label },
70405
+ inputProps: {
70406
+ "aria-label": field.label,
70407
+ "aria-describedby": errors[field.field_name] ? `${field.field_name}-error` : void 0
70408
+ },
70409
+ inputRef: (el) => inputRefs.current[field.field_name] = el,
70397
70410
  label: field.label,
70398
70411
  name: field.field_name,
70399
70412
  onBlur: handleBlur,
@@ -70417,7 +70430,11 @@ const Credentials = React__default.forwardRef(
70417
70430
  fullWidth: true,
70418
70431
  helperText: errors[field.field_name],
70419
70432
  id: field.field_name,
70420
- inputProps: { "aria-label": __("Enter your %1", field.label) },
70433
+ inputProps: {
70434
+ "aria-label": __("Enter your %1", field.label),
70435
+ "aria-describedby": errors[field.field_name] ? `${field.field_name}-error` : void 0
70436
+ },
70437
+ inputRef: (el) => inputRefs.current[field.field_name] = el,
70421
70438
  label: field.label,
70422
70439
  name: field.field_name,
70423
70440
  onChange: handleUserNameTextChange,