-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: accessibility improvements #992
Changes from all commits
43140fc
7360dca
44930f5
2534143
d73fb9a
bb9e90d
c69c697
3cda5c9
a2ff0a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,7 +108,7 @@ function RecoverPasswordForm() { | |
{globalErrorMessage && <Flash variant="danger">{globalErrorMessage}</Flash>} | ||
|
||
<FormControl id="password"> | ||
<FormControl.Label>Senha</FormControl.Label> | ||
<FormControl.Label id="recover-token__label-password">Senha</FormControl.Label> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 Que tal criar um componente wrapper para o De qualquer forma, recomendo esperar mais algum comentário antes de implementar o que eu sugeri aqui, caso concorde. Talvez o @aprendendofelipe possa trazer a opinião dele quando estiver com tempo disponível 👍 Fiz uma sugestão parecida no PR #926, porém mais simples e com outra intenção, sem colocar o There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Faz sentido para mim sua proposta. O que você acha @aprendendofelipe ? |
||
<TextInput | ||
ref={passwordRef} | ||
onChange={clearErrors} | ||
|
@@ -122,6 +122,7 @@ function RecoverPasswordForm() { | |
size="large" | ||
block={true} | ||
aria-label="Sua senha" | ||
aria-describedby="recover-token__label-password" | ||
/> | ||
{capsLockWarningMessage && ( | ||
<FormControl.Validation variant="warning">{capsLockWarningMessage}</FormControl.Validation> | ||
|
@@ -135,7 +136,7 @@ function RecoverPasswordForm() { | |
</FormControl> | ||
|
||
<FormControl id="passwordConfirm"> | ||
<FormControl.Label>Repita a senha</FormControl.Label> | ||
<FormControl.Label id="recover-token__label-confirm-password">Repita a senha</FormControl.Label> | ||
<TextInput | ||
ref={passwordConfirmRef} | ||
onChange={clearErrors} | ||
|
@@ -147,6 +148,7 @@ function RecoverPasswordForm() { | |
size="large" | ||
block={true} | ||
aria-label="Repita a senha" | ||
aria-describedby="recover-token__label-confirm-password" | ||
/> | ||
{errorObject?.key === 'password_confirm' && ( | ||
<FormControl.Validation variant="error">{errorObject.message}</FormControl.Validation> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -437,7 +437,9 @@ function EditMode({ contentObject, setContentObject, setComponentMode, localStor | |
|
||
{!contentObject?.parent_id && ( | ||
<FormControl id="title"> | ||
<FormControl.Label visuallyHidden>Título</FormControl.Label> | ||
<FormControl.Label visuallyHidden id="content__label-title"> | ||
Título | ||
</FormControl.Label> | ||
<TextInput | ||
onChange={handleChange} | ||
onKeyDown={onKeyDown} | ||
|
@@ -448,6 +450,7 @@ function EditMode({ contentObject, setContentObject, setComponentMode, localStor | |
spellCheck={false} | ||
placeholder="Título" | ||
aria-label="Título" | ||
aria-describedby="content__label-title" | ||
// eslint-disable-next-line jsx-a11y/no-autofocus | ||
autoFocus={true} | ||
block={true} | ||
|
@@ -480,7 +483,9 @@ function EditMode({ contentObject, setContentObject, setComponentMode, localStor | |
|
||
{!contentObject?.parent_id && ( | ||
<FormControl id="source_url"> | ||
<FormControl.Label visuallyHidden>Fonte (opcional)</FormControl.Label> | ||
<FormControl.Label visuallyHidden id="content__label-source"> | ||
Fonte (opcional) | ||
</FormControl.Label> | ||
<TextInput | ||
onChange={handleChange} | ||
onKeyDown={onKeyDown} | ||
|
@@ -491,6 +496,7 @@ function EditMode({ contentObject, setContentObject, setComponentMode, localStor | |
spellCheck={false} | ||
placeholder="Fonte (opcional)" | ||
aria-label="Fonte (opcional)" | ||
aria-describedby="content__label-source" | ||
block={true} | ||
value={newData.source_url} | ||
/> | ||
|
@@ -513,7 +519,12 @@ function EditMode({ contentObject, setContentObject, setComponentMode, localStor | |
Cancelar | ||
</Button> | ||
)} | ||
<Button variant="primary" type="submit" disabled={isPosting} aria-label="Publicar"> | ||
<Button | ||
variant="primary" | ||
type="submit" | ||
disabled={isPosting} | ||
aria-label="Publicar" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
sx={{ background: '#237B3C' }}> | ||
{contentObject?.id ? 'Atualizar' : 'Publicar'} | ||
</Button> | ||
</Box> | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -21,7 +21,8 @@ export default function ContentList({ contentList, pagination, paginationBasePat | |||||
display: 'grid', | ||||||
gap: '0.5rem', | ||||||
gridTemplateColumns: 'auto 1fr', | ||||||
}}> | ||||||
}} | ||||||
role={'list'}> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Conforme comentários do hitmain13:
Suggested change
|
||||||
<RenderItems /> | ||||||
<EndOfRelevant /> | ||||||
</Box> | ||||||
|
@@ -84,7 +85,7 @@ export default function ContentList({ contentList, pagination, paginationBasePat | |||||
{itemCount}. | ||||||
</Text> | ||||||
</Box>, | ||||||
<Box as="article" key={contentObject.id} sx={{ overflow: 'auto' }}> | ||||||
<Box as="article" key={contentObject.id} sx={{ overflow: 'auto' }} role="listitem"> | ||||||
<Box | ||||||
sx={{ | ||||||
overflow: 'auto', | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,8 @@ export default function Footer(props) { | |
justifyContent: 'center', | ||
flexWrap: 'wrap-reverse', | ||
gap: 3, | ||
}}> | ||
}} | ||
as="nav"> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
|
@@ -28,7 +29,7 @@ export default function Footer(props) { | |
color: 'fg.subtle', | ||
}}> | ||
<Link href="/" sx={{ color: 'fg.subtle' }}> | ||
<CgTab size={26} /> | ||
<CgTab size={26} title="Acessar a página inicial" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 O
A 3 me parece fazer mais sentido, mas não posso afirmar isso com certeza. Edit: no caso da 3, pensei em ficar com ambos atributos: o |
||
</Link> | ||
© {new Date().getFullYear()} TabNews | ||
</Box> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dando uma olhada na documentação do MDN, que tal usarmos o atributo
for
nalabel
ao invés deid
earia-describedby
para vincular alabel
com oinput
?No site a11y-101 tem um caso de uso melhor para o atributo
aria-describedby
.Não sou especialista nesses pontos de acessibilidade, então se eu estiver enganado, me avise 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E aí, @Rafatcb ! Tudo bem? Concordo com o que você disse sobre a troca.
No caso, eu havia atribuído o aria-describedby via ID, pois verifiquei que este atributo está sendo gerado automaticamente com valor vazio. (Fiz essa inspeção via plugin WAVE). Ao invés de deixá-lo vazio, atribuí a ele o valor da label.
Entretanto você trouxe um ponto bem pertinente que, de fato, não é este o objetivo dele. Então em relação a vínculo, farei a troca para o FOR como você sugeriu. Obrigado.