DashboardSave: Autofocus save dashboard form input (#22748)

This commit is contained in:
Dominik Prokop 2020-03-12 11:50:50 +01:00 committed by GitHub
parent b51e28bc15
commit b441b73345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -75,7 +75,12 @@ export const SaveDashboardAsForm: React.FC<SaveDashboardFormProps & { isNew?: bo
{({ register, control, errors }) => ( {({ register, control, errors }) => (
<> <>
<Forms.Field label="Dashboard name" invalid={!!errors.title} error="Dashboard name is required"> <Forms.Field label="Dashboard name" invalid={!!errors.title} error="Dashboard name is required">
<Forms.Input name="title" ref={register({ required: true })} aria-label="Save dashboard title field" /> <Forms.Input
name="title"
ref={register({ required: true })}
aria-label="Save dashboard title field"
autoFocus
/>
</Forms.Field> </Forms.Field>
<Forms.Field label="Folder"> <Forms.Field label="Folder">
<Forms.InputControl <Forms.InputControl

View File

@ -31,7 +31,12 @@ export const SaveDashboardForm: React.FC<SaveDashboardFormProps> = ({ dashboard,
{({ register, errors }) => ( {({ register, errors }) => (
<> <>
<Forms.Field label="Changes description"> <Forms.Field label="Changes description">
<Forms.TextArea name="message" ref={register} placeholder="Add a note to describe your changes..." /> <Forms.TextArea
name="message"
ref={register}
placeholder="Add a note to describe your changes..."
autoFocus
/>
</Forms.Field> </Forms.Field>
{hasTimeChanged && ( {hasTimeChanged && (
<Forms.Field label="Save current time range" description="Dashboard time range has changed"> <Forms.Field label="Save current time range" description="Dashboard time range has changed">