Skip to content

Commit

Permalink
fix(auth): fix console error controlled checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
royschut committed Aug 6, 2021
1 parent e293764 commit b4f9379
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/components/Account/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ const Account = ({
<Checkbox
key={index}
name={consent.name}
value={values.consents?.[consent.name] || ''}
value={values.consents?.[consent.value] || ''}
checked={(values.consents?.[consent.name] as boolean) || false}
onChange={(event) => (handleChange ? handleChange(event, { nestInto: 'consents' }) : null)}
label={formatConsentLabel(consent.label)}
Expand Down
11 changes: 1 addition & 10 deletions src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,7 @@ const Dropdown: React.FC<Props & React.AriaAttributes> = ({
</label>
)}
<div className={classNames(styles.dropdown, { [styles.fullWidth]: fullWidth })}>
<select
id={id}
className={styles.select}
name={name}
value={value}
onChange={onChange}
aria-required={required}
defaultValue={defaultLabel}
{...rest}
>
<select id={id} className={styles.select} name={name} value={value} onChange={onChange} aria-required={required} {...rest}>
{defaultLabel && (
<option className={classNames(styles.option, optionsStyle)} value="" disabled={required}>
{defaultLabel}
Expand Down
8 changes: 4 additions & 4 deletions src/components/RegistrationForm/RegistrationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ const RegistrationForm: React.FC<Props> = ({
label={t('registration.password')}
placeholder={t('registration.password')}
error={!!errors.password || !!errors.form}
helperText={(
helperText={
<React.Fragment>
<PasswordStrength password={values.password} />
{t('registration.password_helper_text')}
</React.Fragment>
)}
}
name="password"
type={viewPassword ? 'text' : 'password'}
rightControl={
Expand All @@ -118,10 +118,10 @@ const RegistrationForm: React.FC<Props> = ({
<Checkbox
key={index}
name={consent.name}
value={consent.name}
value={consent.value || ''}
error={consentErrors?.includes(consent.name)}
required={consent.required}
checked={consentValues[consent.name]}
checked={consentValues[consent.name] || false}
onChange={onConsentChange}
label={formatConsentLabel(consent.label)}
/>
Expand Down

0 comments on commit b4f9379

Please sign in to comment.