Skip to content

Commit 03eba6e

Browse files
committed
frontend: Fix ARIA labels for SecretField
1 parent b3b39c5 commit 03eba6e

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

frontend/src/components/common/Resource/Resource.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,13 @@ export function DataField(props: DataFieldProps) {
499499
);
500500
}
501501

502-
export function SecretField(props: InputProps) {
503-
const { value, ...other } = props;
502+
export interface SecretFieldProps extends InputProps {
503+
value: string;
504+
nameID?: string;
505+
}
506+
507+
export function SecretField(props: SecretFieldProps) {
508+
const { value, nameID, ...other } = props;
504509
const [showPassword, setShowPassword] = React.useState(false);
505510
const [copied, setCopied] = React.useState(false);
506511
const { t } = useTranslation();
@@ -555,6 +560,7 @@ export function SecretField(props: InputProps) {
555560
</Grid>
556561
<Grid item xs>
557562
<Input
563+
aria-labelledby={nameID}
558564
readOnly={!showPassword}
559565
type="password"
560566
fullWidth

frontend/src/components/secret/Details.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ export default function SecretDetails(props: {
102102

103103
const mainRows: NameValueTableRow[] = Object.entries(data).map((item: unknown[]) => ({
104104
name: item[0] as string,
105+
nameID: item[0] as string,
105106
value: (
106107
<SecretField
107108
value={item[1]}
109+
nameID={item[0] as string}
108110
onChange={e => handleFieldChange(item[0] as string, e.target.value)}
109111
/>
110112
),

frontend/src/components/secret/__snapshots__/Details.WithBase.stories.storyshot

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@
234234
>
235235
<dt
236236
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12 MuiGrid-grid-sm-4 css-1iczkge-MuiGrid-root"
237+
id="storageClassName"
237238
>
238239
storageClassName
239240
</dt>
@@ -272,6 +273,7 @@
272273
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-true css-1z0dvx8-MuiGrid-root"
273274
>
274275
<div
276+
aria-labelledby="storageClassName"
275277
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth Mui-readOnly MuiInputBase-readOnly css-zam05p-MuiInputBase-root-MuiInput-root"
276278
>
277279
<input
@@ -286,6 +288,7 @@
286288
</dd>
287289
<dt
288290
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12 MuiGrid-grid-sm-4 css-1iczkge-MuiGrid-root"
291+
id="volumeMode"
289292
>
290293
volumeMode
291294
</dt>
@@ -324,6 +327,7 @@
324327
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-true css-1z0dvx8-MuiGrid-root"
325328
>
326329
<div
330+
aria-labelledby="volumeMode"
327331
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth Mui-readOnly MuiInputBase-readOnly css-zam05p-MuiInputBase-root-MuiInput-root"
328332
>
329333
<input
@@ -338,6 +342,7 @@
338342
</dd>
339343
<dt
340344
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12 MuiGrid-grid-sm-4 css-iqixpy-MuiGrid-root"
345+
id="volumeName"
341346
>
342347
volumeName
343348
</dt>
@@ -376,6 +381,7 @@
376381
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-true css-1z0dvx8-MuiGrid-root"
377382
>
378383
<div
384+
aria-labelledby="volumeName"
379385
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth Mui-readOnly MuiInputBase-readOnly css-zam05p-MuiInputBase-root-MuiInput-root"
380386
>
381387
<input

0 commit comments

Comments
 (0)