Skip to content

Commit

Permalink
chore: wrap password input in form element to avoid warning in chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
micahgodbolt committed Nov 9, 2023
1 parent f500d2b commit 0f2264b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Type = () => {
const styles = useStyles();

return (
<div className={styles.root}>
<form noValidate autoComplete="off" className={styles.root}>
<div>
<Label htmlFor={emailId}>Email input</Label>
<Input type="email" id={emailId} />
Expand All @@ -34,7 +34,7 @@ export const Type = () => {
<Label htmlFor={passwordId}>Password input</Label>
<Input type="password" defaultValue="password" id={passwordId} />
</div>
</div>
</form>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,30 @@ const columnProps: Partial<IStackProps> = {

export const TextFieldBasicExample: React.FunctionComponent = () => {
return (
<Stack horizontal tokens={stackTokens} styles={stackStyles}>
<Stack {...columnProps}>
<TextField label="Standard" />
<TextField label="Disabled" disabled defaultValue="I am disabled" />
<TextField label="Read-only" readOnly defaultValue="I am read-only" />
<TextField label="Required " required />
<TextField ariaLabel="Required without visible label" required />
<TextField label="With error message" errorMessage="Error message" />
<form noValidate autoComplete="off">
<Stack horizontal tokens={stackTokens} styles={stackStyles}>
<Stack {...columnProps}>
<TextField label="Standard" />
<TextField label="Disabled" disabled defaultValue="I am disabled" />
<TextField label="Read-only" readOnly defaultValue="I am read-only" />
<TextField label="Required " required />
<TextField ariaLabel="Required without visible label" required />
<TextField label="With error message" errorMessage="Error message" />
</Stack>
<Stack {...columnProps}>
<MaskedTextField label="With input mask" mask="m\ask: (999) 999 - 9999" title="A 10 digit number" />
<TextField label="With an icon" iconProps={iconProps} />
<TextField label="With placeholder" placeholder="Please enter text here" />
<TextField label="Disabled with placeholder" disabled placeholder="I am disabled" />
{/* All password fields should be rendered inside of a form */}
<TextField
label="Password with reveal button"
type="password"
canRevealPassword
revealPasswordAriaLabel="Show password"
/>
</Stack>
</Stack>
<Stack {...columnProps}>
<MaskedTextField label="With input mask" mask="m\ask: (999) 999 - 9999" title="A 10 digit number" />
<TextField label="With an icon" iconProps={iconProps} />
<TextField label="With placeholder" placeholder="Please enter text here" />
<TextField label="Disabled with placeholder" disabled placeholder="I am disabled" />
<TextField
label="Password with reveal button"
type="password"
canRevealPassword
revealPasswordAriaLabel="Show password"
/>
</Stack>
</Stack>
</form>
);
};

0 comments on commit 0f2264b

Please sign in to comment.