Skip to content

Commit b5db1bf

Browse files
jacobloganlawmichaJordan-NelsonjosefaidtHuiSF
authored
Merge main into next-release/main (#7901)
* Update versions.ts Android Amplify V2.19.1 (#7767) * chore(flutter): update android section of Amplify Flutter getting started guide (#7760) * chore: update android section of Flutter getting started guide * chore: update gen 2 flutter platform setup * chore: add info to enable network permissions on android * chore: update H3 headers to H2 * chore: update min Xcode version to 15 * chore: update xcode verison to 15.0 for macOS * chore: update ios and macos setup to be consistent with Android, add callout for missing podfile * update mobile quickstarts with link to fullstack branch deployment guide #7741 (#7746) * chore: add serverComponentsExternalPackages callout for Next.js (#7757) * chore: add serverComponentsExternalPackages callout for Next.js * Apply suggestions from code review Co-authored-by: Jim Blanchard <jim.l.blanchard@gmail.com> * Apply suggestions from code review * Update src/pages/gen1/[platform]/build-a-backend/server-side-rendering/nextjs/index.mdx Co-authored-by: Jim Blanchard <jim.l.blanchard@gmail.com> * Update src/pages/gen1/[platform]/build-a-backend/server-side-rendering/nextjs/index.mdx Co-authored-by: josef <josef.aidt@gmail.com> * Update src/pages/[platform]/build-a-backend/server-side-rendering/index.mdx Co-authored-by: josef <josef.aidt@gmail.com> --------- Co-authored-by: Jim Blanchard <jim.l.blanchard@gmail.com> Co-authored-by: josef <josef.aidt@gmail.com> * add warning callout to gen1 backend-config (#7773) * Revert "chore: add region to scrollable table (#7744)" (#7784) This reverts commit 67496c5. * chore: change outputs to amplifyConfig in flutter gen 2 docs (#7764) * chore: change outputs to amplifyConfig in flutter gen 2 docs * chore: change amplifyconfiguration.dart import to amplify_outputs.dart * chore: remove --outputs-version 0 and downgrade config file callout * chore: remove --outputs-version 0 from snippets * chore: remove gen 2 config conversion callout * chore: remove amplifyconfiguration.dart references from gen 2 * fix: heading order on gen1/prev subscribe-data page (#7790) * add warning regarding subscription and mutation redaction of relational fields (#7768) * add warning regarding subscription and mutation redaction of relational fields * replace authn with authz in warning * chore(api): Callout for field redaction on Swift Android relational models * Update src/pages/gen1/[platform]/build-a-backend/graphqlapi/relational-models/index.mdx * add feature flag to warning for gen 1 * Fix heading order in fragments affecting this page * add protected redaction message components * Add tests for redaction message Gen 1 and Gen 2 components * add snapshots for redaction Gen 1 and Gen 2 component tests * Adds ProtectedRedactionMessage components for Gen 1 and Gen2 * Render ProtectedRedactionGen1Message component on Gen 1 realtime page * Render ProtectedRedactionGen1Message component on Gen 2 data modeling page * Render ProtectedRedactionGen2Message component on Gen 2 realtime page * Render ProtectedRedactionGen1Message component on Gen 1 data modeling page * Render ProtectedRedactionGen1Message component on Gen 1 V5 realtime page * add subscriptionsInheritPrimaryAuth as a feature flag * correct version for subscriptionsInheritPrimaryAuth * remove commented code * fix heading order --------- Co-authored-by: Michael Law <1365977+lawmicha@users.noreply.github.com> Co-authored-by: Heather <hbuchel@gmail.com> Co-authored-by: katiegoines <katiegoines@gmail.com> * fix subscriptionsInheritPrimaryAuth default value (#7795) * change overview card titles from p to h2 (#7780) Co-authored-by: katiegoines <katiegoines@gmail.com> * remove conditional in aria-describedby={codeId} for MDXCopyCodeButton (#7779) Co-authored-by: katiegoines <katiegoines@gmail.com> * Update index.mdx to fix typo (#7798) Removed mention of create-vite-app * add workflow to validate redirects (#7726) * add workflow to validate redirects * change filename * removing testing errors * finding all invalid redirects * running validation to catch all issues * remove unneeded code --------- Co-authored-by: katiegoines <katiegoines@gmail.com> * update set up function guide with data example (#7759) * update set up function guide with data example * add mobile snippets * remove checkboxes and circle (#7783) * fix: heading order (#7803) * restore autoSignIn section for SignIn page, and Switching Authentication Flows page for js categories (#7769) Co-authored-by: JoonWon Choi <joonwonc@amazon.com> * replace `amplify` to `ampx` (#7804) * feat(js): list api subpathStrategy parameter (#7794) * feat(js): list api subpathStrategy parameter * fix: adds style guide suggestions * fix: adds result structure * fix: tried to delineate between recursive exploration of entire path and subpathStrategy option * Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx Co-authored-by: Harshita Daddala <harshita.d11@gmail.com> * Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx Co-authored-by: Harshita Daddala <harshita.d11@gmail.com> * Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx Co-authored-by: Harshita Daddala <harshita.d11@gmail.com> * Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx Co-authored-by: Harshita Daddala <harshita.d11@gmail.com> * Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx Co-authored-by: ashika112 <155593080+ashika112@users.noreply.github.com> * Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx Co-authored-by: josef <josef.aidt@gmail.com> * comments and prettier * undid prettier table change * Update src/pages/[platform]/build-a-backend/storage/list-files/index.mdx Co-authored-by: josef <josef.aidt@gmail.com> --------- Co-authored-by: haverchuck <dnnoyes@amazon.com> Co-authored-by: Harshita Daddala <harshita.d11@gmail.com> Co-authored-by: ashika112 <155593080+ashika112@users.noreply.github.com> Co-authored-by: josef <josef.aidt@gmail.com> * chore: update domains for proxy (#7808) * fix: typo on client code generation page (#7809) * Fix anchor link, add some scroll margin to h4 headings (#7810) * chore(deps): bump @aws-amplify/amplify-cli-core from 4.3.8 to 4.3.9 (#7788) Bumps [@aws-amplify/amplify-cli-core](https://github.com/aws-amplify/amplify-cli/tree/HEAD/packages/amplify-cli-core) from 4.3.8 to 4.3.9. - [Release notes](https://github.com/aws-amplify/amplify-cli/releases) - [Changelog](https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-cli-core/CHANGELOG.md) - [Commits](https://github.com/aws-amplify/amplify-cli/commits/@aws-amplify/amplify-cli-core@4.3.9/packages/amplify-cli-core) --- updated-dependencies: - dependency-name: "@aws-amplify/amplify-cli-core" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump aws-actions/aws-secretsmanager-get-secrets (#7792) Bumps [aws-actions/aws-secretsmanager-get-secrets](https://github.com/aws-actions/aws-secretsmanager-get-secrets) from 2.0.3 to 2.0.5. - [Release notes](https://github.com/aws-actions/aws-secretsmanager-get-secrets/releases) - [Commits](aws-actions/aws-secretsmanager-get-secrets@ff26a0a...98c2d6b) --- updated-dependencies: - dependency-name: aws-actions/aws-secretsmanager-get-secrets dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * storage(android): update getURL options (#7736) * storage(android): update getURL options * add more code examples * Add Gen 2 SDL docs (#7793) * add gen 2 SDL docs * Update src/pages/[platform]/build-a-backend/data/data-modeling/index.mdx Co-authored-by: josef <josef.aidt@gmail.com> * Update src/pages/[platform]/build-a-backend/data/data-modeling/index.mdx Co-authored-by: josef <josef.aidt@gmail.com> * move support callout to migration page * update doc to state ddb-backed sources only * made updates to the sdl explanation --------- Co-authored-by: josef <josef.aidt@gmail.com> Co-authored-by: Nikhil Swaminathan <nikhil@live.ca> * Cbonif/add-non-model-auth-section (#7817) * add callout for sql custom query/mutation return types with example * Merge branch 'main' of github.com:aws-amplify/docs * revert sql page change * revert change on gen 1 sql page * add auth permissions (#7796) * add auth permissions * fix accessibility error * fix heading * callout for mysql/postgres custom query return types (#7813) * add callout for sql custom query/mutation return types with example * add gen 1 example * shorten gen 2 example a bit * remove line breaks from gen 1 example * remove line break * Update index.mdx Co-authored-by: josef <josef.aidt@gmail.com> * Update src/pages/gen1/[platform]/build-a-backend/graphqlapi/connect-api-to-existing-database/index.mdx Co-authored-by: josef <josef.aidt@gmail.com> * remove ts import from bottom of page --------- Co-authored-by: josef <josef.aidt@gmail.com> * Clarify Manual Loading of Environment Variables in Sandbox Environments (#7822) * Clarify Manual Loading of Environment Variables in Sandbox Environments * Update src/pages/[platform]/deploy-and-host/fullstack-branching/secrets-and-vars/index.mdx Co-authored-by: josef <josef.aidt@gmail.com> --------- Co-authored-by: josef <josef.aidt@gmail.com> * fix data env name in function example, ref #7825 (#7826) * Update app id reference for CI/CD deployments (#7832) * fix(swift): updated concurrency in quickstart (#7828) * chore(android): Update versions.ts - Android SDK 2.76.0(#7833) * feat(Swift): Adding SubpathStrategy documentation for Storage.List (#7831) * Add Gen1 banner to getting started pages (#7839) * add Gen1 Banner to all gen 1 getting started pages * update link location and add banner to how amplify works --------- Co-authored-by: Jacob Logan <lognjc@amazon.com> * remove temporary disabling of copy-code button (#7835) Co-authored-by: katiegoines <katiegoines@gmail.com> * add streaming function logs docs (#7841) * add streaming function logs docs * Update src/pages/[platform]/build-a-backend/functions/streaming-logs/index.mdx Co-authored-by: Amplifiyer <51211245+Amplifiyer@users.noreply.github.com> * rm multiline log callout, added note for chaining --out-file * clarify log output in terminal where sandbox is running --------- Co-authored-by: Amplifiyer <51211245+Amplifiyer@users.noreply.github.com> * a11y-when closing accordion from bottom, focus back on summary element (#7837) * when closing accordion from bottom, focus back on summary element * add test * remove extra spaces --------- Co-authored-by: katiegoines <katiegoines@gmail.com> * a11y-remove alt text for decorative image (#7836) * remove alt text for decorative image * mark images as decorative --------- Co-authored-by: katiegoines <katiegoines@gmail.com> * Update index.mdx (#7840) * put feedback responses in aria-live (#7844) Co-authored-by: katiegoines <katiegoines@gmail.com> * when clicking on toc entry, focus on respective heading in content (#7845) Co-authored-by: katiegoines <katiegoines@gmail.com> * add scheduling functions docs (#7842) * add scheduling functions docs * fix path * Update src/pages/[platform]/build-a-backend/functions/scheduling-functions/index.mdx * add docs for auth custom attribute support (#7846) * add docs for auth custom attribute support * Update src/pages/[platform]/build-a-backend/auth/concepts/user-attributes/index.mdx * correct heading order * fix broken links * add mobile platform to concepts page for user attributes * remove studio reference in Amplify Gen 2 docs (#7860) * storage(android): update storage list with delimiter support (#7830) * feat(Swift): Adding SubpathStrategy documentation for Storage.List * storage(android): update storage list with delimiter support * feat(Swift): Adding SubpathStrategy documentation for Storage.List * chore: resolve review comments * chore: update per review comments * chore: resolve review comments * fix exclude subpath sample --------- Co-authored-by: Sebastian Villena <97059974+ruisebas@users.noreply.github.com> * Add resolution for fast-xml-parser (#7859) * a11y videos have aria-hidden but can still receive focus (#7866) * adding ariaDescriptions onto some videos to test for required prop build failure * testing error for missing prop * testing error for missing prop * fixing testing failure * re-order props * re-order props * fix invalid heading order * replace prop name --------- Co-authored-by: katiegoines <katiegoines@gmail.com> * chore(flutter): added push notifications snippet for updated settings.gradle file (#7848) * chore: added push notifications snippet for updated settings.gradle file * chore: remove commented code * fix: change gen2 monorepo setting image path (#7786) * fix: change gen2 monorepo setting image path * empty commit * fix: empty commit * fix: delete new line * adds storage, user and data management pages (#7814) * adds storage, user and data mangement pages * add non-dev mode info to figma to react docs (#7878) * rework "use existing cognito resources" prose, highlight configuring client libs directly (#7806) * rework "use existing cognito resources" prose, highlight configuring client libs directly * pivot use existing aws resources page to generalized 'connect _to_' * rm backend snippets in favor of referenceAuth rfc * a11y- add more descriptive text to learn more in gen2 modal (#7869) * add more descriptive text to learn more in gen2 modal * remove excess space * Update src/components/Modal/Modal.tsx Co-authored-by: Heather Buchel <hbuchel@gmail.com> --------- Co-authored-by: katiegoines <katiegoines@gmail.com> Co-authored-by: Heather Buchel <hbuchel@gmail.com> * a11y - add aria-label to external link instances (#7874) * remove import * adding externallink aria-labels --------- Co-authored-by: katiegoines <katiegoines@gmail.com> * add id to popovertrigger (#7881) Co-authored-by: katiegoines <katiegoines@gmail.com> * fix: removed hyphen from the logGroupName (#7856) * updated the logGroupName * added vendedlogs to cspell.json * updated the fieldname is index mapping * updating axios dependency to use new safe version (#7886) * update cdk bootstrap cmd (#7889) * update cdk bootstrap cmd * Update index.mdx * Update index.mdx * Add Docs for Email Invitation Customization (#7891) * add email invite template docs * Update src/pages/[platform]/build-a-backend/auth/customize-auth-lifecycle/email-customization/index.mdx Co-authored-by: josef <josef.aidt@gmail.com> --------- Co-authored-by: josef <josef.aidt@gmail.com> * [Multi-bucket] Storage - add multi bucket setup and usage examples (#7858) * adding multi bucket sections / examples * adding callout for copy * fix link * adding list example and rewording * rename to remove support * add setup section and update links * fix accessibility violations * remove from non JS sections * update download files option language Co-authored-by: ashika112 <155593080+ashika112@users.noreply.github.com> * update copy example to include alternatives * update language for alternative on download Co-authored-by: ashika112 <155593080+ashika112@users.noreply.github.com> * punctuation * unify language across pages * adding title to copy section * adding subpath strategy to options * resolve broken link * manual override amplify outputs * remove type def * remove amplify outputs in setup guide * modify existing storage examples * remove section from download * remove section from list page * remove section from remove * update copy files page * unify language * unify language * modify existing resources section * use resource config in override * addressing feedback * remove redundant link * address feedback * add / update links * add full code examples * update heading * clean up code samples * full examples on setup page * remove redundant text * consistent setup examples * restructure storage setup * simplify upload code examples * update tables with default values * update code snippets * Revamp list file code * update upload examples * fix leak * address feedback * moved / revamped storage without backend section --------- Co-authored-by: ashika112 <155593080+ashika112@users.noreply.github.com> Co-authored-by: ashika112 <akasivis@amazon.com> * remove untrue claim about device tracking (#7898) * Feat (Auth): added docs for fetchCurrentDevice API (#7737) Feat (Auth): added docs for fetchCurrentDevice API (#7737) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Michael Law <1365977+lawmicha@users.noreply.github.com> Co-authored-by: Jordan Nelson <nejrd@amazon.com> Co-authored-by: josef <josef.aidt@gmail.com> Co-authored-by: Hui Zhao <10602282+HuiSF@users.noreply.github.com> Co-authored-by: Jim Blanchard <jim.l.blanchard@gmail.com> Co-authored-by: Heather Buchel <hbuchel@gmail.com> Co-authored-by: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Co-authored-by: Chris Bonifacio <christopher.bonifacio@gmail.com> Co-authored-by: katiegoines <katiegoines@gmail.com> Co-authored-by: Dane Pilcher <dppilche@amazon.com> Co-authored-by: Katie Goines <30757403+katiegoines@users.noreply.github.com> Co-authored-by: Nikhil Swaminathan <2429410+swaminator@users.noreply.github.com> Co-authored-by: Kethan sai <ykethan@amazon.com> Co-authored-by: Joon Choi <requiemdeciel@gmail.com> Co-authored-by: JoonWon Choi <joonwonc@amazon.com> Co-authored-by: MURAKAMI Masahiko <fossamagna2@gmail.com> Co-authored-by: Dustin Noyes <dustin.noyes.dev@gmail.com> Co-authored-by: haverchuck <dnnoyes@amazon.com> Co-authored-by: Harshita Daddala <harshita.d11@gmail.com> Co-authored-by: ashika112 <155593080+ashika112@users.noreply.github.com> Co-authored-by: MJ Zhang <0618@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tuan Pham <103537251+phantumcode@users.noreply.github.com> Co-authored-by: Nikhil Swaminathan <nikhil@live.ca> Co-authored-by: Kazuki Hamasaki <ne.vivam.si.abis@gmail.com> Co-authored-by: Jay Raval <jay.ambrish.raval@gmail.com> Co-authored-by: Sébastien Stormacq <sebastien.stormacq@gmail.com> Co-authored-by: Sebastian Villena <97059974+ruisebas@users.noreply.github.com> Co-authored-by: Jacob Logan <lognjc@amazon.com> Co-authored-by: Amplifiyer <51211245+Amplifiyer@users.noreply.github.com> Co-authored-by: taka <106423245+takaya-okamoto@users.noreply.github.com> Co-authored-by: Emma Sauerborn <70536670+esauerbo@users.noreply.github.com> Co-authored-by: magisystem0408 <61937077+magisystem0408@users.noreply.github.com> Co-authored-by: Anil Maktala <maktala.anil@gmail.com> Co-authored-by: Jordan Van Ness <jordvn@amazon.com> Co-authored-by: James Graham <grahamjamesr7@users.noreply.github.com> Co-authored-by: James Jarvis <jjarvisp@amazon.com> Co-authored-by: ashika112 <akasivis@amazon.com> Co-authored-by: Kamil Sobol <sobol.k.r@gmail.com> Co-authored-by: Andrew Hahn <58017052+hahnandrew@users.noreply.github.com>
1 parent b6368aa commit b5db1bf

File tree

71 files changed

+1205
-433
lines changed

Some content is hidden

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

71 files changed

+1205
-433
lines changed

Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ let mut a = String::from("a");
175175
Videos can be added using the `<Video />` component and referencing a path to the video file. The video should be an `.mp4` file and should exist in the `/public` directory
176176

177177
```jsx
178-
<Video src="/path/to/video.mp4" />
178+
<Video src="/path/to/video.mp4" description="Video - [video description]" />
179179
```
180180

181181
## Accessibility testing

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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",
@@ -89,7 +89,7 @@
8989
"loader-utils": "2.0.4",
9090
"minimatch": "3.1.2",
9191
"decode-uri-component": "0.2.1",
92-
"fast-xml-parser": "4.2.5",
92+
"**/fast-xml-parser": "4.4.1",
9393
"semver": "7.5.2",
9494
"tough-cookie": "4.1.3",
9595
"aws-cdk-lib": "2.80.0",
Loading
643 KB
Binary file not shown.
994 KB
Binary file not shown.
1.5 MB
Binary file not shown.

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 () => {

src/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/components/GlobalNav/__tests__/GlobalNav.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ describe('GlobalNav', () => {
2929

3030
it('should render the GlobalNav component', async () => {
3131
render(component);
32-
const link = await screen.findByRole('link', { name: 'About AWS Amplify' });
32+
const link = await screen.findByRole('link', {
33+
name: 'About AWS Amplify (opens in new tab)'
34+
});
3335
expect(link).toBeInTheDocument();
3436
});
3537
});

src/components/GlobalNav/components/NavMenuLink.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export function NavMenuLink({
4040
return (
4141
<Link
4242
isExternal={true}
43+
aria-label={label + ' (opens in new tab)'}
4344
className="navbar-menu-item"
4445
href={navMenuItem.url}
4546
>

src/components/LinkCard/LinkCard.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ const LinkCard: React.FC<LinkCardProps> = ({
1616
}) => {
1717
return (
1818
href && (
19-
<Link href={href} isExternal={isExternal} className="link-card">
19+
<Link
20+
href={href}
21+
isExternal={isExternal}
22+
className="link-card"
23+
aria-label={children + ' (opens in new tab)'}
24+
>
2025
<Flex direction="column" justifyContent="space-between" height="100%">
2126
<View>{icon()}</View>
2227
<View className="link-card-children">{children}</View>

src/components/LinkCards/__tests__/LinkCards.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ describe('LinkCards', () => {
77
it('should render the LinkCards component', async () => {
88
render(component);
99
const linkCardNode = await screen.findByRole('link', {
10-
name: 'React Libraries on GitHub'
10+
name: 'React Libraries on GitHub (opens in new tab)'
1111
});
1212
expect(linkCardNode).toBeInTheDocument();
1313
});
1414

1515
it('should link each card to external href', async () => {
1616
render(component);
1717
const githubCard = await screen.findByRole('link', {
18-
name: 'React Libraries on GitHub'
18+
name: 'React Libraries on GitHub (opens in new tab)'
1919
});
2020
const discordCard = await screen.findByRole('link', {
21-
name: 'Amplify Discord'
21+
name: 'Amplify Discord (opens in new tab)'
2222
});
2323
const learnCard = await screen.findByRole('link', {
24-
name: 'Amplify Learn'
24+
name: 'Amplify Learn (opens in new tab)'
2525
});
2626

2727
expect(githubCard.href).toBe('https://github.com/aws-amplify/amplify-ui');

src/components/MDXComponents/__tests__/MDXLink.test.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const routerMock = {
1616
jest.mock('next/router', () => routerMock);
1717

1818
describe('MDXLink', () => {
19-
it('should render external link', () => {
19+
it('should render external link', async () => {
2020
const externalUrl = 'https://amazon.com';
2121
const linkText = 'External Site';
2222

@@ -26,10 +26,16 @@ describe('MDXLink', () => {
2626
</MDXLink>
2727
);
2828

29-
const linkElement = screen.getByRole('link', { name: linkText });
29+
const linkElement = await screen.getByRole('link', {
30+
name: '(opens in new tab)'
31+
});
32+
const linkElementText = await screen.findByText('External Site');
3033
expect(linkElement).toBeInTheDocument();
3134
expect(linkElement).toHaveAttribute('href', externalUrl);
3235
expect(linkElement).toHaveAttribute('rel', 'noopener noreferrer');
36+
expect(linkElementText).toBeInTheDocument();
37+
expect(linkElementText).toHaveAttribute('href', externalUrl);
38+
expect(linkElementText).toHaveAttribute('rel', 'noopener noreferrer');
3339
});
3440

3541
it('should render internal link', () => {

src/components/Menu/MenuItem.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export function MenuItem({
156156
className={`menu__list-item__link menu__list-item__link--external ${listItemLinkStyle}`}
157157
href={pageNode.route}
158158
isExternal={true}
159+
aria-label={pageNode.title + ' (opens in new tab)'}
159160
onClick={onLinkClick}
160161
>
161162
<Flex

src/components/Menu/RepoActions/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ export default function RepoActions({ router }) {
1616
{shouldShowEditLink && (
1717
<Flex className="repo-actions">
1818
<ExternalLink href={editLink}>
19-
<Flex
20-
className="repo-actions-link"
21-
aria-label="Edit this page on GitHub"
22-
>
19+
<Flex className="repo-actions-link">
2320
<IconPencil />
2421
Edit on GitHub
2522
</Flex>

src/components/Modal/Modal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ export const Modal = ({ isGen1 }: ModalProps) => {
113113
variation="primary"
114114
className="modal-action modal-action--primary"
115115
>
116-
Learn more <IconChevron className="icon-rotate-270" />
116+
Learn more about Gen 2
117+
<IconChevron className="icon-rotate-270" />
117118
</InternalLinkButton>
118119
</Flex>
119120
</Flex>

src/components/PlatformNavigator/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ export function PlatformNavigator({
5151
<Flex alignItems="center">
5252
<Popover flex="1 0 auto">
5353
<Popover.Trigger
54+
id="selectedLabel"
5455
className={`platform-navigator__button`}
5556
isFullWidth={true}
56-
aria-describedby="platformNavigatorLabel"
57+
aria-labelledby="platformNavigatorLabel selectedLabel"
5758
>
5859
{platformItem.icon}
5960
{platformTitle}

src/components/Video/Video.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useState, useEffect, useRef } from 'react';
22
import { View } from '@aws-amplify/ui-react';
33

44
interface VideoProps {
5+
description: string;
56
autoPlay?: boolean;
67
muted?: boolean;
78
loop?: true;
@@ -14,17 +15,21 @@ export const reducedMotionMediaQuery =
1415

1516
/**
1617
* @description The Video component defaults to a muted, auto play video.
17-
* Currently, we also assume the surrounding content will adequately describe
18-
* the video so we default to aria-hidden="true".
1918
*/
2019
export const Video = ({
20+
description,
2121
autoPlay = true,
2222
muted = true,
2323
loop = true,
2424
src,
2525
testId,
2626
...rest
2727
}: VideoProps) => {
28+
if (!description) {
29+
throw new Error(
30+
`<Video src="${src}"> is missing required description prop`
31+
);
32+
}
2833
/**
2934
* Assume user prefers reduced motion until we can check
3035
* in the useEffect for the media query match, otherwise Next SSG
@@ -70,7 +75,7 @@ export const Video = ({
7075
width="100%"
7176
playsInline={true}
7277
controls={true}
73-
aria-hidden="true"
78+
aria-label={description}
7479
testId={testId}
7580
{...rest}
7681
>

src/components/Video/__tests__/Video.test.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ const playSpy = jest
3030

3131
describe('Video', () => {
3232
const testId = 'videoTest';
33-
const component = <Video src="test-video.mp4" testId={testId}></Video>;
33+
const component = (
34+
<Video
35+
src="test-video.mp4"
36+
description="Video - Test"
37+
testId={testId}
38+
></Video>
39+
);
3440

3541
beforeEach(() => {
3642
mockMatchMedia('');

src/components/contribute/HowItWorks.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
Divider,
3-
Flex,
4-
Heading,
5-
Text,
6-
Badge,
7-
Link
8-
} from '@aws-amplify/ui-react';
1+
import { Divider, Flex, Heading, Text, Badge } from '@aws-amplify/ui-react';
92
import {
103
MdOutlineBadge,
114
MdLabelOutline,
@@ -14,6 +7,7 @@ import {
147
} from 'react-icons/md';
158
import { FiGitPullRequest } from 'react-icons/fi';
169
import { IconCheck, IconExternalLink } from '@/components/Icons';
10+
import ExternalLink from '../ExternalLink';
1711

1812
export default function HowItWorks() {
1913
return (
@@ -123,9 +117,9 @@ export default function HowItWorks() {
123117
<Text>
124118
If this is your first approved pull request, the Amplify team
125119
designates you as a Contributor in the{' '}
126-
<Link href="https://discord.com/invite/amplify" isExternal>
120+
<ExternalLink href="https://discord.com/invite/amplify">
127121
Amplify Community Discord server <IconExternalLink />
128-
</Link>
122+
</ExternalLink>
129123
.
130124
</Text>
131125
</Flex>
@@ -147,12 +141,9 @@ export default function HowItWorks() {
147141
</Flex>
148142
<Text>
149143
You collect an{' '}
150-
<Link
151-
href="https://aws.amazon.com/blogs/mobile/new-introducing-the-amplify-badge-program/"
152-
isExternal
153-
>
144+
<ExternalLink href="https://aws.amazon.com/blogs/mobile/new-introducing-the-amplify-badge-program/">
154145
Amplify badge <IconExternalLink />
155-
</Link>{' '}
146+
</ExternalLink>{' '}
156147
for your first contribution or make progress toward the Intermediate
157148
and Advanced badges!
158149
</Text>

0 commit comments

Comments
 (0)