Skip to content

Commit 0151b25

Browse files
Fix labels on some callout icons. (#986)
1 parent 8d0b8d3 commit 0151b25

File tree

5 files changed

+31
-9
lines changed

5 files changed

+31
-9
lines changed

src/components/Database/DatabaseContainer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const DatabaseContainer: React.FC<React.PropsWithChildren<Props>> = ({
6060
<GridCell span={12} className="Database-Container">
6161
{hasNewDbs && (
6262
<Callout
63-
icon="info"
63+
type="note"
6464
actions={
6565
<Button theme="secondary" onClick={() => setDbs(databases)}>
6666
Reload

src/components/Database/DatabasePicker.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ const DatabaseListItem: React.FC<
5353
<ListItem
5454
activated={activated}
5555
tag={Link}
56+
aria-label={
57+
// If this is the active DB, adjust the screen reader label to indicate as much.
58+
activated ? name + ', currently selected' : ''
59+
}
5660
to={to}
5761
data-testid={`nav-${name}`}
5862
>

src/components/common/Callout.tsx

+5-7
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,16 @@ import React, { ReactNode } from 'react';
2424
import { CustomThemeProvider, CustomThemeType, Type } from '../../themes';
2525

2626
export interface CalloutProps {
27-
/** Custom icon to override the default */
28-
icon?: string;
2927
/** Show a lighter version of the callout */
3028
aside?: true;
3129
/** The color scheme of the callout. Defaults to 'note' */
3230
type?: CustomThemeType;
33-
3431
/** Action buttons */
3532
actions?: ReactNode;
3633
}
3734

35+
// Using a type from the map ensures we can apply the correct aria label in
36+
// addition to providing easy-to-use defaults.
3837
const DEFAULT_ICON_MAP: Record<string, string> = {
3938
[Type.CAUTION]: 'error',
4039
[Type.NOTE]: 'info',
@@ -45,12 +44,11 @@ const DEFAULT_ICON_MAP: Record<string, string> = {
4544

4645
export const Callout: React.FC<React.PropsWithChildren<CalloutProps>> = ({
4746
children,
48-
actions,
49-
icon,
5047
aside,
5148
type = Type.NOTE,
49+
actions,
5250
}) => {
53-
const iconName = icon || DEFAULT_ICON_MAP[type];
51+
const iconName = DEFAULT_ICON_MAP[type];
5452
const asideClass = aside ? ' Callout-aside' : '';
5553
const classes = `Callout Callout-${type}${asideClass}`;
5654

@@ -66,7 +64,7 @@ export const Callout: React.FC<React.PropsWithChildren<CalloutProps>> = ({
6664
{iconName && (
6765
<Icon
6866
icon={iconName}
69-
aria-hidden="true"
67+
aria-label={iconName + ' icon'}
7068
className="Callout-icon"
7169
/>
7270
)}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"a":"b"}
+20-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
{"version":"7.15.1","firestore":{"version":"1.11.1","path":"firestore_export","metadata_file":"firestore_export/firestore_export.overall_export_metadata"}}
1+
{
2+
"version": "12.4.4",
3+
"firestore": {
4+
"version": "1.18.1",
5+
"path": "firestore_export",
6+
"metadata_file": "firestore_export/firestore_export.overall_export_metadata"
7+
},
8+
"database": {
9+
"version": "4.11.2",
10+
"path": "database_export"
11+
},
12+
"auth": {
13+
"version": "12.4.4",
14+
"path": "auth_export"
15+
},
16+
"storage": {
17+
"version": "12.4.4",
18+
"path": "storage_export"
19+
}
20+
}

0 commit comments

Comments
 (0)