Skip to content

Commit 743496f

Browse files
committed
fix: accessibility issue caused by an incorrect idp mapping
1 parent 473a060 commit 743496f

File tree

6 files changed

+35
-11
lines changed

6 files changed

+35
-11
lines changed

src/oneid/oneid-fe/src/pages/login/components/CieButton/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const CieButton = ({ onClick }: CieButtonProps) => {
2626
variant="contained"
2727
startIcon={<CieIconWrapper />}
2828
onClick={onClick}
29+
aria-label="CIE Login"
2930
>
3031
{t('loginPage.loginBox.cieLogin')}
3132
</Button>

src/oneid/oneid-fe/src/pages/login/components/SpidModal/SpidModal.test.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,18 @@ vi.mock('../../../../utils/utils', () => ({
1212

1313
const mockIdpList = {
1414
identityProviders: [
15-
{ entityID: 'idp1', name: 'IDP 1', imageUrl: 'image1.png' },
16-
{ entityID: 'idp2', name: 'IDP 2', imageUrl: 'image2.png' },
15+
{
16+
active: true,
17+
entityID: 'idp1',
18+
friendlyName: 'IDP 1',
19+
imageUrl: 'image1.png',
20+
},
21+
{
22+
active: true,
23+
entityID: 'idp2',
24+
friendlyName: 'IDP 2',
25+
imageUrl: 'image2.png',
26+
},
1727
],
1828
} as IdentityProviders;
1929

src/oneid/oneid-fe/src/pages/login/components/SpidSelect/SpidSelect.test.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,20 @@ afterAll(() => {
1414
});
1515
const idpList = {
1616
identityProviders: [
17-
{ identifier: 'test', entityID: 'testID', name: 'test', imageUrl: 'test' },
17+
{
18+
active: true,
19+
entityID: 'testID',
20+
friendlyName: 'test',
21+
imageUrl: 'test',
22+
},
1823
],
1924
richiediSpid: '',
2025
};
2126
test('go to the spid url', () => {
2227
render(<SpidSelect onBack={() => null} idpList={idpList} />);
2328

2429
idpList.identityProviders.forEach((element) => {
25-
const spidImg = screen.getByAltText(element.name);
30+
const spidImg = screen.getByAltText(element.friendlyName);
2631
const spidSpan = spidImg.parentNode;
2732
const spidButton = spidSpan?.parentNode;
2833
fireEvent.click(spidButton as Element);

src/oneid/oneid-fe/src/pages/login/components/SpidSelection.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const getSPID = (IDP: IdentityProvider) => {
1212
trackEvent(
1313
'LOGIN_IDP_SELECTED',
1414
{
15-
SPID_IDP_NAME: IDP.name,
15+
SPID_IDP_NAME: IDP.friendlyName,
1616
SPID_IDP_ID: IDP.entityID,
1717
FORWARD_PARAMETERS: params,
1818
},
@@ -42,7 +42,7 @@ export const SpidSelection = ({
4242
backgroundColor: 'background.default',
4343
alignItems: 'center',
4444
}}
45-
aria-label={IDP.name}
45+
aria-label={IDP.friendlyName}
4646
id={IDP.entityID}
4747
data-testid={`idp-button-${IDP.entityID}`}
4848
>
@@ -57,7 +57,7 @@ export const SpidSelection = ({
5757
<ImageWithFallback
5858
width="100px"
5959
src={IDP.imageUrl}
60-
alt={IDP.name}
60+
alt={IDP.friendlyName}
6161
placeholder={IDP_PLACEHOLDER_IMG}
6262
/>
6363
</Icon>

src/oneid/oneid-fe/src/services/api.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@ describe('Utils functions', () => {
1818

1919
describe('getIdpList', () => {
2020
const mockIDPList: Array<Omit<IdentityProvider, 'imageUrl'>> = [
21-
{ entityID: 'idp1', name: 'IDP 1', identifier: 'idp-identifier-1' },
22-
{ entityID: 'idp2', name: 'IDP 2', identifier: 'idp-identifier-2' },
21+
{
22+
active: true,
23+
entityID: 'idp1',
24+
friendlyName: 'IDP 1',
25+
},
26+
{
27+
active: true,
28+
entityID: 'idp2',
29+
friendlyName: 'IDP 2',
30+
},
2331
];
2432

2533
it('returns a enhanced IDP list', async () => {

src/oneid/oneid-fe/src/utils/IDPS.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export type IdentityProvider = {
2-
identifier: string;
2+
active: boolean;
33
entityID: string;
4-
name: string;
4+
friendlyName: string;
55
imageUrl: string;
66
};
77

0 commit comments

Comments
 (0)