Skip to content

Commit

Permalink
Fix focus jumps from Case description box back to Alerts table with f…
Browse files Browse the repository at this point in the history
…irst <return> keystroke (#111273) (#111691)

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Pablo Machado <[email protected]>
  • Loading branch information
kibanamachine and machadoum authored Sep 9, 2021
1 parent 7051a5e commit e584d54
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion x-pack/plugins/cases/public/components/create/form_context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,20 @@ export const FormContext: React.FC<Props> = ({
: null,
[children, connectors, isLoadingConnectors]
);
return <Form form={form}>{childrenWithExtraProp}</Form>;
return (
<Form
onKeyDown={(e: KeyboardEvent) => {
// It avoids the focus scaping from the flyout when enter is pressed.
// https://github.com/elastic/kibana/issues/111120
if (e.key === 'Enter') {
e.stopPropagation();
}
}}
form={form}
>
{childrenWithExtraProp}
</Form>
);
};

FormContext.displayName = 'FormContext';
1 change: 1 addition & 0 deletions x-pack/plugins/cases/public/components/create/title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const TitleComponent: React.FC<Props> = ({ isLoading }) => (
idAria: 'caseTitle',
'data-test-subj': 'caseTitle',
euiFieldProps: {
autoFocus: true,
fullWidth: true,
disabled: isLoading,
},
Expand Down

0 comments on commit e584d54

Please sign in to comment.