fix(a11y): input not having associated label on MS trophy page (#52179)

This commit is contained in:
Huyen Nguyen
2023-11-01 22:13:19 +07:00
committed by GitHub
parent 59a8501f42
commit 4919ac65fd
3 changed files with 11 additions and 2 deletions
@@ -420,7 +420,6 @@ class ShowExam extends Component<ShowExamProps, ShowExamState> {
({ answer, id }) => (
<label className='exam-answer-label' key={id}>
<input
aria-label={t('aria.answer')}
checked={
userExamQuestions[currentQuestionIndex].answer
.id === id
@@ -151,10 +151,11 @@ function LinkMsUser({
<Spacer size='medium' />
<form onSubmit={handleLinkUsername}>
<FormGroup validationState={isValid ? 'success' : 'error'}>
<ControlLabel>
<ControlLabel htmlFor='transcript-link'>
<strong>{t('learn.ms.transcript-label')}</strong>
</ControlLabel>
<FormControl
id='transcript-link'
type='url'
onChange={handleInputChange}
placeholder='https://learn.microsoft.com/en-us/users/username/transcript/transcriptId'
+9
View File
@@ -64,5 +64,14 @@ test.describe('Link MS user component (unlinked signedIn user)', () => {
const linkText6 = page.getByTestId('link-li-6-text');
await expect(linkText6).toBeVisible();
await expect(linkText6).toHaveText(translations.learn.ms['link-li-6']);
const transcriptLinkInput = page.getByLabel(
translations.learn.ms['transcript-label']
);
await expect(transcriptLinkInput).toBeVisible();
await expect(transcriptLinkInput).toHaveAttribute(
'placeholder',
'https://learn.microsoft.com/en-us/users/username/transcript/transcriptId'
);
});
});