-
Notifications
You must be signed in to change notification settings - Fork 7
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 a11y for contacts page - PN-12920 #1369
Changes from 2 commits
b32105f
3b1665a
e44e984
e257ed2
c8c8f52
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 |
---|---|---|
|
@@ -55,11 +55,14 @@ const ContactsSummaryCard: React.FC<ContactsSummaryCardProps> = ({ | |
return t('summary-card.no-address'); | ||
} | ||
|
||
const contactsType = availableAddresses.reduce((acc, item) => { | ||
// eslint-disable-next-line functional/immutable-data | ||
acc[item.channelType] = t(`summary-card.${item.channelType}`); | ||
return acc; | ||
}, {} as { [key: string]: string }); | ||
const contactsType = availableAddresses.reduce( | ||
(acc, item) => { | ||
// eslint-disable-next-line functional/immutable-data | ||
acc[item.channelType] = t(`summary-card.${item.channelType}`); | ||
return acc; | ||
}, | ||
{} as { [key: string]: string } | ||
); | ||
|
||
return Object.values(contactsType).join(', '); | ||
}; | ||
|
@@ -89,26 +92,19 @@ const ContactsSummaryCard: React.FC<ContactsSummaryCardProps> = ({ | |
sx={{ width: { xs: '100%', lg: '185px' } }} | ||
data-testid={isCourtesyCard ? 'courtesyContactsCard' : 'legalContactsCard'} | ||
> | ||
<CardActionArea | ||
onClick={goToSection} | ||
sx={{ p: 2 }} | ||
aria-label={t(title)} | ||
aria-description={getDescription()} | ||
> | ||
<CardActionArea onClick={goToSection} sx={{ p: 2 }}> | ||
{getIcon()} | ||
<Typography | ||
variant="body2" | ||
fontWeight={600} | ||
data-testid="cardTitle" | ||
aria-hidden | ||
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. this should not be removed. why did you remove it? 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. on windows the card are not read 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. I tried with windows and also with aria-hidden it was read 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. do I restore it? 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. we have to understand how to fix the problem. The card is a button so, when user goes on the card, the screen reader should read the content (i.e. the title and the subititle). The aria-hidden is to avoid that screen reader reads the content twice 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. with aria-hidden the text 'A valore legale' and 'Di cortesia' are not read by windows voice assistant. |
||
sx={{ mt: 0.5, mb: 1 }} | ||
> | ||
{t(title)} | ||
</Typography> | ||
<Typography | ||
variant="body2" | ||
data-testid="cardDescription" | ||
aria-hidden | ||
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. same as before 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. same as before |
||
color={hasAddress ? 'primary' : 'text.secondary'} | ||
> | ||
{getDescription()} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,10 @@ vi.mock('react-i18next', () => ({ | |
|
||
describe('testing profile page', () => { | ||
it('profile page renders properly', () => { | ||
const { getByRole, getByText } = render(<Profile />, { | ||
const { getByText } = render(<Profile />, { | ||
preloadedState: { userState: { user: userResponse } }, | ||
}); | ||
const title = getByRole('heading', { name: 'title' }); | ||
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. why this change? 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. test failure with that role 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. it is strange, this should not happen |
||
const title = getByText('title'); | ||
expect(title).toBeInTheDocument(); | ||
const subtitle = getByText('subtitle'); | ||
expect(subtitle).toBeInTheDocument(); | ||
|
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.
aria-labels on typography are wrongs, because the screen reader reads the text twice. Maybe the problem is on the typography variant
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.
in the windows os screen reader not read without that
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.
mmm it is not the correct way to fix the bug
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.
which is?
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.
try on your own