mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
refactor(console): add a11y to the SenderTester
(#2636)
This commit is contained in:
parent
89651833d2
commit
91b82fef3f
2 changed files with 8 additions and 2 deletions
|
@ -12,6 +12,7 @@ import FormField from '@/components/FormField';
|
|||
import TextInput from '@/components/TextInput';
|
||||
import { Tooltip } from '@/components/Tip';
|
||||
import useApi from '@/hooks/use-api';
|
||||
import { onKeyDownHandler } from '@/utilities/a11y';
|
||||
import { safeParseJson } from '@/utilities/json';
|
||||
|
||||
import * as styles from './index.module.scss';
|
||||
|
@ -90,6 +91,7 @@ const SenderTester = ({ connectorId, connectorType, config, className }: Props)
|
|||
? t('connector_details.test_sms_placeholder')
|
||||
: t('connector_details.test_email_placeholder')
|
||||
}
|
||||
onKeyDown={onKeyDownHandler({ Enter: onSubmit })}
|
||||
{...register('sendTo', {
|
||||
required: true,
|
||||
pattern: {
|
||||
|
|
|
@ -15,7 +15,11 @@ export const onKeyDownHandler =
|
|||
}
|
||||
|
||||
if (typeof callback === 'object') {
|
||||
callback[key]?.(event);
|
||||
event.preventDefault();
|
||||
const handler = callback[key];
|
||||
|
||||
if (handler) {
|
||||
handler(event);
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue