Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit b8de5f1

Browse files
authored
chore: clean up aria labels (#886)
1 parent 4a908d5 commit b8de5f1

35 files changed

+84
-21
lines changed

packages/core/src/components/collections/CollectionHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const CollectionHeader: FC<TranslatedProps<CollectionHeaderProps>> = ({ collecti
7272
{newEntryUrl ? (
7373
<Button to={newEntryUrl} className={collectionClasses['new-entry-button']}>
7474
{t('collection.collectionTop.newButton', {
75-
collectionLabel: collectionLabelSingular || pluralLabel,
75+
collectionLabel: collectionLabelSingular ?? pluralLabel,
7676
})}
7777
</Button>
7878
) : null}

packages/core/src/components/collections/FilterControl.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const FilterControl = ({
8383
color={anyActive ? 'primary' : 'secondary'}
8484
variant={anyActive ? 'contained' : 'outlined'}
8585
rootClassName={classes.root}
86+
aria-label="filter options dropdown"
8687
>
8788
<MenuGroup>
8889
{viewFilters.map(viewFilter => {

packages/core/src/components/collections/GroupControl.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const GroupControl = ({
7979
color={activeGroup ? 'primary' : 'secondary'}
8080
variant={activeGroup ? 'contained' : 'outlined'}
8181
rootClassName={classes.root}
82+
aria-label="group by options dropdown"
8283
>
8384
<MenuGroup>
8485
{viewGroups.map(viewGroup => (

packages/core/src/components/collections/SortControl.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ const SortControl = ({
123123
color={selectedSort.key ? 'primary' : 'secondary'}
124124
variant={selectedSort.key ? 'contained' : 'outlined'}
125125
rootClassName={classes.root}
126+
aria-label="sort options dropdown"
126127
>
127128
<MenuGroup>
128129
{fields.map(field => {

packages/core/src/components/collections/entries/EntriesCollection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ const EntriesCollection = ({
128128
variant={index === selectedGroup ? 'contained' : 'text'}
129129
onClick={handleGroupClick(index)}
130130
className={entriesClasses['group-button']}
131+
aria-label={`group by ${title}`}
131132
>
132133
{title}
133134
</Button>

packages/core/src/components/collections/mobile/MobileCollectionControls.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const MobileCollectionControls: FC<MobileCollectionControlsProps> = props => {
3232
className={mobileCollectionControlsClasses.toggle}
3333
variant="text"
3434
onClick={toggleMobileMenu}
35+
aria-label="toggle menu"
3536
>
3637
<FilterListIcon className={mobileCollectionControlsClasses['toggle-icon']} />
3738
</IconButton>

packages/core/src/components/common/autocomplete/Autocomplete.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ const Autocomplete = ({
201201
disabled={disabled}
202202
className={classes.button}
203203
onClick={handleDropdownButtonClick}
204+
aria-label="open options"
204205
>
205206
<KeyboardArrowDownIcon className={classes['button-icon']} aria-hidden="true" />
206207
</IconButton>
@@ -211,6 +212,7 @@ const Autocomplete = ({
211212
disabled={disabled}
212213
className={classes.button}
213214
onClick={clear}
215+
aria-label="clear"
214216
>
215217
<CloseIcon className={classes['button-icon']} aria-hidden="true" />
216218
</IconButton>

packages/core/src/components/common/menu/Menu.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export interface MenuProps {
4343
disabled?: boolean;
4444
keepMounted?: boolean;
4545
'data-testid'?: string;
46+
'aria-label': string;
4647
}
4748

4849
const Menu = ({
@@ -63,6 +64,7 @@ const Menu = ({
6364
disabled = false,
6465
keepMounted = false,
6566
'data-testid': dataTestId,
67+
'aria-label': ariaLabel,
6668
}: MenuProps) => {
6769
const calculatedButtonClassName = useButtonClassNames(variant, color, size, rounded);
6870

@@ -87,6 +89,7 @@ const Menu = ({
8789
data-testid={dataTestId}
8890
className={menuButtonClassNames}
8991
disabled={disabled}
92+
aria-label={ariaLabel}
9093
>
9194
{StartIcon ? (
9295
<StartIcon className={classNames(classes['dropdown-start-icon'], iconClassName)} />

packages/core/src/components/common/view-style/ViewStyleControl.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const ViewStyleControl = ({ viewStyle, onChangeViewStyle }: ViewStyleControlPros
2424
color={viewStyle === VIEW_STYLE_TABLE ? 'primary' : 'secondary'}
2525
variant="text"
2626
className={classes.button}
27-
aria-label="table view"
27+
aria-label="table view option"
2828
onClick={() => onChangeViewStyle(VIEW_STYLE_TABLE)}
2929
>
3030
<TableRowsIcon className={classes.icon} />
@@ -33,7 +33,7 @@ const ViewStyleControl = ({ viewStyle, onChangeViewStyle }: ViewStyleControlPros
3333
color={viewStyle === VIEW_STYLE_GRID ? 'primary' : 'secondary'}
3434
variant="text"
3535
className={classes.button}
36-
aria-label="grid view"
36+
aria-label="grid view option"
3737
onClick={() => onChangeViewStyle(VIEW_STYLE_GRID)}
3838
>
3939
<GridIcon className={classes.icon} />

packages/core/src/components/entry-editor/EditorToolbar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ const EditorToolbar = ({
202202
rootClassName={classes['more-menu']}
203203
buttonClassName={classes['more-menu-button']}
204204
hideDropdownIcon
205+
aria-label="more options dropdown"
205206
>
206207
<MenuGroup>
207208
{showI18nToggle && (
@@ -252,6 +253,7 @@ const EditorToolbar = ({
252253
variant={showMobilePreview ? 'contained' : 'text'}
253254
onClick={onMobilePreviewToggle}
254255
className={classes['preview-toggle']}
256+
aria-label="toggle preview"
255257
>
256258
<EyeIcon className={classes['preview-toggle-icon']} />
257259
</IconButton>
@@ -264,6 +266,7 @@ const EditorToolbar = ({
264266
variant="text"
265267
onClick={onDelete}
266268
className={classes['delete-button']}
269+
aria-label="delete"
267270
>
268271
<TrashIcon className={classes['delete-button-icon']} />
269272
</IconButton>
@@ -279,6 +282,7 @@ const EditorToolbar = ({
279282
iconClassName={classes['publish-button-icon']}
280283
labelClassName={classes['publish-button-label']}
281284
hideDropdownIconOnMobile
285+
aria-label="publish options dropdown"
282286
>
283287
{menuItems.map((group, index) => (
284288
<MenuGroup key={`menu-group-${index}`}>{group}</MenuGroup>

0 commit comments

Comments
 (0)