FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(loginForm): adds autoFocus to username input by jenny-s51 · Pull Request #2659 · patternfly/patternfly-react · GitHub

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

Filter by extension

Filter by extension .snap  (1) .tsx  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
    • LoginForm.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { Button } from '../Button';
import { Checkbox } from '../Checkbox';

export interface LoginFormProps extends React.HTMLProps<HTMLFormElement> {
/** Flag to indicate if the first dropdown item should not gain initial focus */
noAutoFocus?: boolean,
/** Additional classes added to the Login Main Body's Form */
className?: string;
/** Flag indicating the Helper Text is visible * */
Expand Down Expand Up @@ -46,6 +48,7 @@ export interface LoginFormProps extends React.HTMLProps<HTMLFormElement> {
}

export const LoginForm: React.FunctionComponent<LoginFormProps> = ({
noAutoFocus = false,
className = '',
showHelperText = false,
helperText = null,
Expand All @@ -71,7 +74,7 @@ export const LoginForm: React.FunctionComponent<LoginFormProps> = ({
{helperText}
</FormHelperText>
<FormGroup label={usernameLabel} isRequired isValid={isValidUsername} fieldId="pf-login-username-id">
<TextInput
<TextInput autoFocus={!noAutoFocus}
id="pf-login-username-id"
isRequired
isValid={isValidUsername}
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ exports[`LoginForm with rememberMeLabel 1`] = `
>
<TextInput
aria-label={null}
autoFocus={true}
className=""
id="pf-login-username-id"
isDisabled={false}
Expand Down Expand Up @@ -92,6 +93,7 @@ exports[`LoginForm with rememberMeLabel and rememberMeAriaLabel uses the remembe
>
<TextInput
aria-label={null}
autoFocus={true}
className=""
id="pf-login-username-id"
isDisabled={false}
Expand Down Expand Up @@ -168,6 +170,7 @@ exports[`should render Login form 1`] = `
>
<TextInput
aria-label={null}
autoFocus={true}
className=""
id="pf-login-username-id"
isDisabled={false}
Expand Down

Back | FazBrowse Home | New Git URL