-
Notifications
You must be signed in to change notification settings - Fork 375
Dropdown menus - option selection : add aria-hidden on icons #1036
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 | ||||
---|---|---|---|---|---|---|
|
@@ -18,7 +18,7 @@ test.describe('Doc Export', () => { | |||||
await createDoc(page, 'doc-editor', browserName, 1); | ||||||
await page | ||||||
.getByRole('button', { | ||||||
name: 'download', | ||||||
name: 'Export the document', | ||||||
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.
Suggested change
|
||||||
}) | ||||||
.click(); | ||||||
|
||||||
|
@@ -71,7 +71,7 @@ test.describe('Doc Export', () => { | |||||
|
||||||
await page | ||||||
.getByRole('button', { | ||||||
name: 'download', | ||||||
name: 'Export the document', | ||||||
exact: true, | ||||||
}) | ||||||
.click(); | ||||||
|
@@ -121,7 +121,7 @@ test.describe('Doc Export', () => { | |||||
|
||||||
await page | ||||||
.getByRole('button', { | ||||||
name: 'download', | ||||||
name: 'Export the document', | ||||||
exact: true, | ||||||
}) | ||||||
.click(); | ||||||
|
@@ -189,7 +189,7 @@ test.describe('Doc Export', () => { | |||||
|
||||||
await page | ||||||
.getByRole('button', { | ||||||
name: 'download', | ||||||
name: 'Export the document', | ||||||
}) | ||||||
.click(); | ||||||
|
||||||
|
@@ -266,7 +266,7 @@ test.describe('Doc Export', () => { | |||||
|
||||||
await page | ||||||
.getByRole('button', { | ||||||
name: 'download', | ||||||
name: 'Export the document', | ||||||
}) | ||||||
.click(); | ||||||
|
||||||
|
@@ -316,7 +316,7 @@ test.describe('Doc Export', () => { | |||||
|
||||||
await page | ||||||
.getByRole('button', { | ||||||
name: 'download', | ||||||
name: 'Export the document', | ||||||
exact: true, | ||||||
}) | ||||||
.click(); | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,9 @@ test.describe('Doc Header', () => { | |
|
||
await expect(card.getByText('Owner ·')).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'Share' })).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'download' })).toBeVisible(); | ||
await expect( | ||
page.getByRole('button', { name: 'Export the document' }), | ||
).toBeVisible(); | ||
await expect( | ||
page.getByRole('button', { name: 'Open the document options' }), | ||
).toBeVisible(); | ||
|
@@ -116,7 +118,9 @@ test.describe('Doc Header', () => { | |
|
||
await goToGridDoc(page); | ||
|
||
await expect(page.getByRole('button', { name: 'download' })).toBeVisible(); | ||
await expect( | ||
page.getByRole('button', { name: 'Export the document' }), | ||
).toBeVisible(); | ||
|
||
await page.getByLabel('Open the document options').click(); | ||
|
||
|
@@ -139,7 +143,9 @@ test.describe('Doc Header', () => { | |
const invitationRole = invitationCard.getByLabel('doc-role-dropdown'); | ||
await expect(invitationRole).toBeVisible(); | ||
|
||
await invitationRole.click(); | ||
await invitationCard | ||
.getByRole('button', { name: 'Open the invitation options' }) | ||
.click(); | ||
|
||
await page.getByRole('menuitem', { name: 'Remove access' }).click(); | ||
await expect(invitationCard).toBeHidden(); | ||
|
@@ -154,8 +160,13 @@ test.describe('Doc Header', () => { | |
|
||
await roles.click(); | ||
await expect( | ||
page.getByRole('menuitem', { name: 'Remove access' }), | ||
).toBeEnabled(); | ||
memberCard.getByRole('button', { name: 'Open the member options' }), | ||
).toBeVisible(); | ||
await memberCard | ||
.getByRole('button', { name: 'Open the member options' }) | ||
.click(); | ||
|
||
await expect(page.getByLabel('Delete')).toBeEnabled(); | ||
}); | ||
|
||
test('it checks the options available if editor', async ({ page }) => { | ||
|
@@ -186,7 +197,9 @@ test.describe('Doc Header', () => { | |
|
||
await goToGridDoc(page); | ||
|
||
await expect(page.getByRole('button', { name: 'download' })).toBeVisible(); | ||
await expect( | ||
page.getByRole('button', { name: 'Export the document' }), | ||
).toBeVisible(); | ||
await page.getByLabel('Open the document options').click(); | ||
|
||
await expect(page.getByLabel('Delete document')).toBeDisabled(); | ||
|
@@ -207,14 +220,16 @@ test.describe('Doc Header', () => { | |
).toBeVisible(); | ||
await expect(invitationCard.getByLabel('doc-role-text')).toBeVisible(); | ||
await expect( | ||
invitationCard.getByRole('button', { name: 'more_horiz' }), | ||
invitationCard.getByRole('button', { | ||
name: 'Open the invitation options', | ||
}), | ||
).toBeHidden(); | ||
|
||
const memberCard = shareModal.getByLabel('List members card'); | ||
await expect(memberCard.getByText('[email protected]')).toBeVisible(); | ||
await expect(memberCard.getByLabel('doc-role-text')).toBeVisible(); | ||
await expect( | ||
memberCard.getByRole('button', { name: 'more_horiz' }), | ||
memberCard.getByRole('button', { name: 'Open the member options' }), | ||
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 above, extract into a variable if you'd like. |
||
).toBeHidden(); | ||
}); | ||
|
||
|
@@ -246,7 +261,9 @@ test.describe('Doc Header', () => { | |
|
||
await goToGridDoc(page); | ||
|
||
await expect(page.getByRole('button', { name: 'download' })).toBeVisible(); | ||
await expect( | ||
page.getByRole('button', { name: 'Export the document' }), | ||
).toBeVisible(); | ||
await page.getByLabel('Open the document options').click(); | ||
|
||
await expect(page.getByLabel('Delete document')).toBeDisabled(); | ||
|
@@ -267,14 +284,16 @@ test.describe('Doc Header', () => { | |
).toBeVisible(); | ||
await expect(invitationCard.getByLabel('doc-role-text')).toBeVisible(); | ||
await expect( | ||
invitationCard.getByRole('button', { name: 'more_horiz' }), | ||
invitationCard.getByRole('button', { | ||
name: 'Open the invitation options', | ||
}), | ||
).toBeHidden(); | ||
|
||
const memberCard = shareModal.getByLabel('List members card'); | ||
await expect(memberCard.getByText('[email protected]')).toBeVisible(); | ||
await expect(memberCard.getByLabel('doc-role-text')).toBeVisible(); | ||
await expect( | ||
memberCard.getByRole('button', { name: 'more_horiz' }), | ||
memberCard.getByRole('button', { name: 'Open the member options' }), | ||
).toBeHidden(); | ||
}); | ||
|
||
|
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. Just a quick note: It might be cleaner to accept explicit Happy to discuss it further if neededfeel free to reach out! I’ll suggest a snippet below feel free to use it or adapt it as you see fit. |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,6 +14,7 @@ export const Icon = ({ | |||||||||||||||||||
}: IconProps) => { | ||||||||||||||||||||
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. Make the in the IconProps Type :
Suggested 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.
Suggested change
|
||||||||||||||||||||
return ( | ||||||||||||||||||||
<Text | ||||||||||||||||||||
aria-hidden={!!!textProps['aria-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.
Suggested change
|
||||||||||||||||||||
{...textProps} | ||||||||||||||||||||
className={clsx('--docs--icon-bg', textProps.className, { | ||||||||||||||||||||
'material-icons-filled': variant === 'filled', | ||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,9 +252,10 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => { | |
setIsModalExportOpen(true); | ||
}} | ||
size={isSmallMobile ? 'small' : 'medium'} | ||
aria-label={t('Export the document')} | ||
/> | ||
)} | ||
<DropdownMenu options={options}> | ||
<DropdownMenu options={options} label={t('Open the document options')}> | ||
<IconOptions | ||
isHorizontal | ||
$theme="primary" | ||
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. Since the I'd suggest removing it and letting the menu handle accessibility. |
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,7 +2,7 @@ import { Button } from '@openfun/cunningham-react'; | |||||
import { useTranslation } from 'react-i18next'; | ||||||
import { css } from 'styled-components'; | ||||||
|
||||||
import { Box, HorizontalSeparator } from '@/components'; | ||||||
import { Box, HorizontalSeparator, Icon } from '@/components'; | ||||||
import { Doc, useCopyDocLink } from '@/docs/doc-management'; | ||||||
|
||||||
import { DocVisibility } from './DocVisibility'; | ||||||
|
@@ -41,7 +41,7 @@ export const DocShareModalFooter = ({ | |||||
fullWidth={false} | ||||||
onClick={copyDocLink} | ||||||
color="tertiary" | ||||||
icon={<span className="material-icons">add_link</span>} | ||||||
icon={<Icon iconName="add_link" />} | ||||||
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.
Suggested change
|
||||||
> | ||||||
{t('Copy link')} | ||||||
</Button> | ||||||
|
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.
Totally optional: you could create a variable like
const exportButtonLabel = 'Export the document'
to avoid repeating the string and make future changes easier.
Not a blocker at all, just a small DX improvement suggestion :)