Skip to content

Commit 29cbbe4

Browse files
author
katiegoines
committed
Merge branch 'main' into a11y-mobile-toc
2 parents 1f681b0 + c2ec5c0 commit 29cbbe4

File tree

95 files changed

+3470
-1196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3470
-1196
lines changed

cspell.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@
595595
"Figma",
596596
"Figma's",
597597
"figma",
598+
"fileuploader",
598599
"architected",
599600
"newsfeeds",
600601
"textareas",
@@ -1244,7 +1245,6 @@
12441245
"Storage.put",
12451246
"storagebucketname",
12461247
"storagedemo",
1247-
"storagemanager",
12481248
"storageOptions",
12491249
"storagepath",
12501250
"StoragePath",
@@ -1396,6 +1396,7 @@
13961396
"validationData",
13971397
"vanillajs",
13981398
"varchar",
1399+
"vendedlogs",
13991400
"verify.js",
14001401
"VerifyAuthChallengeResponse",
14011402
"VeriSign",

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"private": true,
1111
"dependencies": {
1212
"@aws-amplify/amplify-cli-core": "^4.3.9",
13-
"@aws-amplify/ui-react": "^6.1.12",
13+
"@aws-amplify/ui-react": "^6.3.1",
1414
"@docsearch/react": "3",
1515
"ajv": "^8.16.0",
1616
"aws-amplify": "^6.0.9",
@@ -42,7 +42,7 @@
4242
"@types/react": "^18.0.0",
4343
"@types/url-parse": "^1.4.3",
4444
"@typescript-eslint/eslint-plugin": "^6.13.1",
45-
"axios": "^1.3.4",
45+
"axios": "^1.7.4",
4646
"cheerio": "^1.0.0-rc.12",
4747
"classnames": "^2.3.2",
4848
"cross-env": "^7.0.3",
@@ -75,7 +75,6 @@
7575
"remark-mdx-searchable": "^0.1.3",
7676
"rollup-plugin-node-polyfills": "^0.2.1",
7777
"sass": "^1.77.5",
78-
"serve": "^14.2.1",
7978
"tiny-glob": "0.2.9",
8079
"ts-jest": "^29.1.2",
8180
"ts-node": "^8.5.0",

redirects.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
},
102102
{
103103
"source": "/ui/storage/s3-image-picker/q/framework/<platform>/",
104-
"target": "https://ui.docs.amplify.aws/react/connected-components/storage/storagemanager",
104+
"target": "https://ui.docs.amplify.aws/react/connected-components/storage/fileuploader",
105105
"status": "302"
106106
},
107107
{

src/components/Callout/Callout.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Message, View } from '@aws-amplify/ui-react';
1+
import { Flex, Message } from '@aws-amplify/ui-react';
2+
import { IconWarning, IconInfo } from '../Icons';
23

34
interface CalloutProps {
45
info?: boolean;
@@ -17,8 +18,18 @@ export const Callout = ({
1718
variation="filled"
1819
colorTheme={warning ? 'warning' : 'info'}
1920
backgroundColor={backgroundColor}
21+
hasIcon={false}
2022
>
21-
<View>{children}</View>
23+
<Flex>
24+
<div className="amplify-message__icon">
25+
{warning ? (
26+
<IconWarning aria-hidden={false} aria-label="Warning" />
27+
) : (
28+
<IconInfo aria-hidden={false} aria-label="Important information" />
29+
)}
30+
</div>
31+
<div className="amplify-message__content">{children}</div>
32+
</Flex>
2233
</Message>
2334
);
2435
};

src/components/Callout/__tests__/Callout.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ describe('Callout', () => {
2929
);
3030

3131
const styles = getComputedStyle(ele.container.children[0]);
32-
console.log(styles);
3332
expect(styles.backgroundColor).toBe('red');
3433
});
3534
});

src/components/ExternalLink/__tests__/ExternalLink.test.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,27 @@ describe('ExternalLink', () => {
1414
it('should render the ExternalLink component', async () => {
1515
render(component);
1616
const externalLink = await screen.getByRole('link', {
17-
name: 'Click Here!'
17+
name: '(opens in new tab)'
1818
});
19+
const externalLinkText = await screen.findByText('Click Here!');
1920

20-
expect(externalLink).toBeInTheDocument();
21+
await waitFor(() => {
22+
expect(externalLink).toBeInTheDocument();
23+
expect(externalLinkText).toBeInTheDocument();
24+
});
2125
});
2226

2327
it('should open external links in a new window', async () => {
2428
render(component);
2529
const externalLink = await screen.getByRole('link', {
26-
name: 'Click Here!'
30+
name: '(opens in new tab)'
2731
});
32+
const externalLinkText = await screen.findByText('Click Here!');
2833

2934
expect(externalLink).toHaveAttribute('rel', 'noopener noreferrer');
3035
expect(externalLink).toHaveAttribute('target', '_blank');
36+
expect(externalLinkText).toHaveAttribute('rel', 'noopener noreferrer');
37+
expect(externalLinkText).toHaveAttribute('target', '_blank');
3138
});
3239

3340
it('should trackExternalLink on click', async () => {

src/components/ExternalLink/index.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useEffect, useRef } from 'react';
22
import { trackExternalLink } from '../../utils/track';
33

44
type ExternalLinkProps = {
@@ -15,15 +15,27 @@ const ExternalLink: React.FC<ExternalLinkProps> = ({
1515
href,
1616
className
1717
}) => {
18+
const [label, setLabel] = React.useState('');
19+
const linkRef = useRef<HTMLAnchorElement>(null);
20+
21+
useEffect(() => {
22+
if (linkRef.current) {
23+
const text = linkRef.current.innerText;
24+
setLabel(text ? text : '');
25+
}
26+
}, []);
27+
1828
return (
1929
<a
2030
href={href}
2131
className={className}
32+
aria-label={label + ' (opens in new tab)'}
2233
rel="noopener noreferrer"
2334
target="_blank"
2435
onClick={() => {
2536
trackLink(href);
2637
}}
38+
ref={linkRef}
2739
>
2840
{children}
2941
</a>

src/components/ExternalLinkButton/ExternalLinkButton.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Button, ButtonProps } from '@aws-amplify/ui-react';
22
import { IconExternalLink } from '../Icons';
33
import { trackExternalLink } from '../../utils/track';
4+
import { useEffect, useRef } from 'react';
5+
import React from 'react';
46

57
interface ExternalLinkButtonProps {
68
variation?: ButtonProps['variation'];
@@ -21,6 +23,16 @@ export const ExternalLinkButton = ({
2123
children,
2224
className
2325
}: ExternalLinkButtonProps) => {
26+
const [label, setLabel] = React.useState('');
27+
const buttonRef = useRef<HTMLAnchorElement>(null);
28+
29+
useEffect(() => {
30+
if (buttonRef.current) {
31+
const text = buttonRef.current.innerText;
32+
setLabel(text ? text : '');
33+
}
34+
}, []);
35+
2436
return (
2537
<Button
2638
href={href}
@@ -32,9 +44,11 @@ export const ExternalLinkButton = ({
3244
as="a"
3345
align-items="center"
3446
className={className}
47+
aria-label={label + ' (opens in new tab)'}
3548
onClick={() => {
3649
trackLink(href);
3750
}}
51+
ref={buttonRef}
3852
>
3953
{children} <IconExternalLink />
4054
</Button>

src/components/ExternalLinkButton/__tests__/ExternalLinkButton.test.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@ describe('ExternalLinkButton', () => {
1818
it('should render the ExternalLinkButton component', async () => {
1919
render(component);
2020

21-
const externalLinkButtonNode = await screen.findByRole('link', {
22-
name: 'Click Here!'
21+
const externalLinkButtonNode = await screen.getByRole('link', {
22+
name: '(opens in new tab)'
23+
});
24+
const externalLinkButtonNodeText = await screen.findByText('Click Here!');
25+
26+
await waitFor(() => {
27+
expect(externalLinkButtonNode).toBeInTheDocument();
28+
expect(externalLinkButtonNodeText).toBeInTheDocument();
2329
});
24-
expect(externalLinkButtonNode).toBeInTheDocument();
2530
});
2631

2732
it('should render the ExternalLink icon', async () => {

0 commit comments

Comments
 (0)