Skip to content

Commit 97b928d

Browse files
committed
use i18n key and CCS
1 parent 18cf8c4 commit 97b928d

6 files changed

Lines changed: 22 additions & 11 deletions

File tree

src/v2/view-builder/views/google-authenticator/EnrollAuthenticatorGoogleAuthenticatorView.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,19 @@ const Body = BaseForm.extend({
9090
<span
9191
class="shared-secret no-translate"
9292
tabindex="0"
93-
aria-label="{{sharedSecretSpaced}}"
93+
aria-label="{{sharedSecretAriaLabel}}"
9494
>{{sharedSecret}}</span>
9595
</div>
9696
`,
9797
getTemplateData() {
9898
const sharedSecret = this.options.appState.get('currentAuthenticator').contextualData.sharedSecret || '';
9999
return {
100100
sharedSecret,
101-
sharedSecretSpaced: sharedSecret.split('').join(' '),
101+
sharedSecretAriaLabel: loc(
102+
'oie.enroll.google_authenticator.sharedSecret.ariaLabel',
103+
'login',
104+
[sharedSecret.split('').join(' ')]
105+
),
102106
};
103107
},
104108
}),

src/v3/src/components/Widget/style.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,3 +332,9 @@ span.strong {
332332
span.no-translate {
333333
white-space: nowrap;
334334
}
335+
/* Google Authenticator manual-entry secret key (OKTA-1185578).
336+
* Visual spacing only — the secret stays a single string (no literal spaces)
337+
* so it copies cleanly and a double-click selects the whole value. */
338+
span.shared-secret {
339+
letter-spacing: 0.3em;
340+
}

src/v3/src/transformer/layout/googleAuthenticator/__snapshots__/transformGoogleAuthenticatorEnroll.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Object {
102102
"contentType": "subtitle",
103103
"noTranslate": true,
104104
"options": Object {
105-
"content": "<span tabindex=\\"0\\" aria-label=\\"A B C 1 2 3 D E F 4 5 6\\" style=\\"letter-spacing: 0.3em;\\">ABC123DEF456</span>",
105+
"content": "<span class=\\"shared-secret\\" tabindex=\\"0\\" aria-label=\\"oie.enroll.google_authenticator.sharedSecret.ariaLabel\\">ABC123DEF456</span>",
106106
},
107107
"type": "Description",
108108
"viewIndex": 1,
@@ -263,7 +263,7 @@ Object {
263263
"contentType": "subtitle",
264264
"noTranslate": true,
265265
"options": Object {
266-
"content": "<span tabindex=\\"0\\" aria-label=\\"A B C 1 2 3 D E F 4 5 6\\" style=\\"letter-spacing: 0.3em;\\">ABC123DEF456</span>",
266+
"content": "<span class=\\"shared-secret\\" tabindex=\\"0\\" aria-label=\\"oie.enroll.google_authenticator.sharedSecret.ariaLabel\\">ABC123DEF456</span>",
267267
},
268268
"type": "Description",
269269
"viewIndex": 1,

src/v3/src/transformer/layout/googleAuthenticator/transformGoogleAuthenticatorEnroll.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('Google Authenticator Enroll Transformer Tests', () => {
6969
expect((layoutTwo.elements[1] as DescriptionElement).options.content)
7070
.toBe('oie.enroll.google_authenticator.manualSetupInstructions');
7171
expect((layoutTwo.elements[2] as DescriptionElement).options.content)
72-
.toBe('<span tabindex="0" aria-label="A B C 1 2 3 D E F 4 5 6" style="letter-spacing: 0.3em;">ABC123DEF456</span>');
72+
.toBe('<span class="shared-secret" tabindex="0" aria-label="oie.enroll.google_authenticator.sharedSecret.ariaLabel">ABC123DEF456</span>');
7373
expect((layoutTwo.elements[3] as StepperButtonElement).label)
7474
.toBe('oform.next');
7575
expect((layoutTwo.elements[3] as StepperButtonElement).options.nextStepIndex)

src/v3/src/transformer/layout/googleAuthenticator/transformGoogleAuthenticatorEnroll.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ export const transformGoogleAuthenticatorEnroll: IdxStepTransformer = ({
6060
noTranslate: true,
6161
options: {
6262
// Render the secret as a single contiguous string so that double-clicking
63-
// selects the entire value (OKTA-1185578). letter-spacing keeps it legible,
64-
// tabindex="0" puts it in the tab order, and the aria-label spells out each
65-
// character so screen readers can speak the code one letter at a time on focus.
63+
// selects the entire value (OKTA-1185578). The .shared-secret class adds the
64+
// letter-spacing that keeps it legible, tabindex="0" puts it in the tab order,
65+
// and the aria-label spells out each character so screen readers can speak the
66+
// code one letter at a time on focus.
6667
content: sharedSecret
67-
? `<span tabindex="0" aria-label="${sharedSecret.split('').join(' ')}" style="letter-spacing: 0.3em;">${sharedSecret}</span>`
68+
? `<span class="shared-secret" tabindex="0" aria-label="${loc('oie.enroll.google_authenticator.sharedSecret.ariaLabel', 'login', [sharedSecret.split('').join(' ')])}">${sharedSecret}</span>`
6869
: '',
6970
},
7071
};

src/v3/test/integration/__snapshots__/authenticator-enroll-google-authenticator.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,8 @@ exports[`authenticator-enroll-google-authenticator renders form renders secret k
733733
translate="no"
734734
>
735735
<span
736-
aria-label="K A G W B I X A K O L P E F M Y"
737-
style="letter-spacing: 0.3em;"
736+
aria-label="Secret key: K A G W B I X A K O L P E F M Y"
737+
class="shared-secret"
738738
tabindex="0"
739739
>
740740
KAGWBIXAKOLPEFMY

0 commit comments

Comments
 (0)