Commit b441b733 by Dominik Prokop Committed by GitHub

DashboardSave: Autofocus save dashboard form input (#22748)

parent b51e28bc
...@@ -75,7 +75,12 @@ export const SaveDashboardAsForm: React.FC<SaveDashboardFormProps & { isNew?: bo ...@@ -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
......
...@@ -31,7 +31,12 @@ export const SaveDashboardForm: React.FC<SaveDashboardFormProps> = ({ dashboard, ...@@ -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">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment