add a11y label to monitor script uploader (#225518)

## Summary

Closes #212467

![Screenshot 2025-06-26 at 12 38
17 PM](https://github.com/user-attachments/assets/60b3805b-ce58-48d9-97fe-b946c3a14684)

![Screenshot 2025-06-26 at 12 37
53 PM](https://github.com/user-attachments/assets/cad36c1f-6a77-41eb-a5bd-52c74181c246)
This commit is contained in:
Bailey Cash 2025-06-26 16:19:41 -04:00 committed by GitHub
parent e5455131fe
commit 1c76710f67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,14 +53,10 @@ export function Uploader({ onUpload }: Props) {
}; };
return ( return (
<EuiFormRow <EuiFormRow isInvalid={Boolean(error)} error={error} aria-label={FORM_ROW_LABEL} fullWidth>
isInvalid={Boolean(error)}
error={error}
aria-label={TESTING_SCRIPT_LABEL}
fullWidth
>
<EuiFilePicker <EuiFilePicker
id="syntheticsFleetScriptRecorderUploader" id="syntheticsFleetScriptRecorderUploader"
aria-label={TESTING_SCRIPT_LABEL}
data-test-subj="syntheticsFleetScriptRecorderUploader" data-test-subj="syntheticsFleetScriptRecorderUploader"
ref={filePickerRef as React.Ref<Omit<EuiFilePickerProps, 'stylesMemoizer'>>} ref={filePickerRef as React.Ref<Omit<EuiFilePickerProps, 'stylesMemoizer'>>}
initialPromptText={PROMPT_TEXT} initialPromptText={PROMPT_TEXT}
@ -72,13 +68,17 @@ export function Uploader({ onUpload }: Props) {
); );
} }
const TESTING_SCRIPT_LABEL = i18n.translate( const FORM_ROW_LABEL = i18n.translate(
'xpack.synthetics.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.browser.uploader.fieldLabel', 'xpack.synthetics.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.browser.uploader.fieldLabel',
{ {
defaultMessage: 'Testing script', defaultMessage: 'Testing script',
} }
); );
const TESTING_SCRIPT_LABEL = i18n.translate('xpack.synthetics.monitorEdit.uploader.ariaLabel', {
defaultMessage: 'Input for uploading a script file for your monitor',
});
const PROMPT_TEXT = i18n.translate('xpack.synthetics.monitorConfig.uploader.label', { const PROMPT_TEXT = i18n.translate('xpack.synthetics.monitorConfig.uploader.label', {
defaultMessage: 'Select or drag and drop a .js file', defaultMessage: 'Select or drag and drop a .js file',
}); });