Skip to content

Commit 54fc2b4

Browse files
authored
Merge pull request #85 from grafana/kevinwcyu/use-input-id-for-inputs
Associate label with input element
2 parents 4b57adb + 7d12625 commit 54fc2b4

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

src/components/ConnectionConfig.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionCon
8282
label="Authentication Provider"
8383
labelWidth={labelWidth}
8484
tooltip="Specify which AWS credentials chain to use."
85+
htmlFor="authenticationProvider"
8586
>
8687
<Select
87-
aria-label="Authentication Provider"
88+
inputId="authenticationProvider"
8889
className={inputWidth}
8990
value={currentProvider}
9091
options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}
@@ -100,9 +101,10 @@ export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionCon
100101
label="Credentials Profile Name"
101102
labelWidth={labelWidth}
102103
tooltip="Credentials profile name, as specified in ~/.aws/credentials, leave blank for default."
104+
htmlFor="credentialsProfileName"
103105
>
104106
<Input
105-
aria-label="Credentials Profile Name"
107+
id="credentialsProfileName"
106108
className={inputWidth}
107109
placeholder="default"
108110
value={profile}
@@ -113,7 +115,7 @@ export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionCon
113115

114116
{options.jsonData.authType === 'keys' && (
115117
<>
116-
<InlineField label="Access Key ID" labelWidth={labelWidth}>
118+
<InlineField label="Access Key ID" htmlFor="accessKeyId" labelWidth={labelWidth}>
117119
{props.options.secureJsonFields?.accessKey ? (
118120
<ButtonGroup className={inputWidth}>
119121
<Input disabled placeholder="Configured" />
@@ -126,15 +128,15 @@ export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionCon
126128
</ButtonGroup>
127129
) : (
128130
<Input
129-
aria-label="Access Key ID"
131+
id="accessKeyId"
130132
className={inputWidth}
131133
value={options.secureJsonData?.accessKey ?? ''}
132134
onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}
133135
/>
134136
)}
135137
</InlineField>
136138

137-
<InlineField label="Secret Access Key" labelWidth={labelWidth}>
139+
<InlineField label="Secret Access Key" htmlFor="secretAccessKey" labelWidth={labelWidth}>
138140
{props.options.secureJsonFields?.secretKey ? (
139141
<ButtonGroup className={inputWidth}>
140142
<Input disabled placeholder="Configured" />
@@ -147,7 +149,7 @@ export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionCon
147149
</ButtonGroup>
148150
) : (
149151
<Input
150-
aria-label="Secret Access Key"
152+
id="secretAccessKey"
151153
className={inputWidth}
152154
value={options.secureJsonData?.secretKey ?? ''}
153155
onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}
@@ -221,9 +223,10 @@ export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionCon
221223
label="Assume Role ARN"
222224
labelWidth={labelWidth}
223225
tooltip="Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all"
226+
htmlFor="assumeRoleArn"
224227
>
225228
<Input
226-
aria-label="Assume Role ARN"
229+
id="assumeRoleArn"
227230
className={inputWidth}
228231
placeholder="arn:aws:iam:*"
229232
value={options.jsonData.assumeRoleArn || ''}
@@ -235,9 +238,10 @@ export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionCon
235238
label="External ID"
236239
labelWidth={labelWidth}
237240
tooltip="If you are assuming a role in another account, that has been created with an external ID, specify the external ID here."
241+
htmlFor="externalId"
238242
>
239243
<Input
240-
aria-label="External ID"
244+
id="externalId"
241245
className={inputWidth}
242246
placeholder="External ID"
243247
value={options.jsonData.externalId || ''}
@@ -252,9 +256,10 @@ export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionCon
252256
label="Endpoint"
253257
labelWidth={labelWidth}
254258
tooltip="Optionally, specify a custom endpoint for the service"
259+
htmlFor="endpoint"
255260
>
256261
<Input
257-
aria-label="Endpoint"
262+
id="endpoint"
258263
className={inputWidth}
259264
placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}
260265
value={options.jsonData.endpoint || ''}
@@ -266,9 +271,10 @@ export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionCon
266271
label="Default Region"
267272
labelWidth={labelWidth}
268273
tooltip="Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region."
274+
htmlFor="defaultRegion"
269275
>
270276
<Select
271-
aria-label="Default Region"
277+
inputId="defaultRegion"
272278
className={inputWidth}
273279
value={regions.find((region) => region.value === options.jsonData.defaultRegion)}
274280
options={regions}

src/components/NewConnectionConfig.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ export const NewConnectionConfig = ({
4242
htmlFor="authProvider"
4343
>
4444
<Select
45-
id="authProvider"
46-
aria-label="Authentication Provider"
45+
inputId="authProvider"
4746
value={currentProvider}
4847
options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}
4948
defaultValue={options.jsonData.authType}
@@ -226,8 +225,7 @@ export const NewConnectionConfig = ({
226225
htmlFor="defaultRegion"
227226
>
228227
<Select
229-
id="defaultRegion"
230-
aria-label="Default Region"
228+
inputId="defaultRegion"
231229
value={regions.find((region) => region.value === options.jsonData.defaultRegion)}
232230
options={regions}
233231
defaultValue={options.jsonData.defaultRegion}

0 commit comments

Comments
 (0)