From 2f4e9f170fdf21bf2212a04176a7cb7f795eccf6 Mon Sep 17 00:00:00 2001 From: Vadorequest Date: Thu, 10 Jun 2021 10:01:57 +0200 Subject: [PATCH] Use main, footer, nav and their ARIA equivalent for better a11y (#365) --- src/layouts/core/components/CoreLayout.tsx | 5 +- src/layouts/demo/components/DemoFooter.tsx | 5 +- src/layouts/demo/components/DemoLayout.tsx | 101 +++++++++--------- src/layouts/demo/components/DemoNav.tsx | 1 + .../components/QuickPreviewBanner.tsx | 8 +- .../components/PreviewModeBanner.tsx | 5 +- 6 files changed, 69 insertions(+), 56 deletions(-) diff --git a/src/layouts/core/components/CoreLayout.tsx b/src/layouts/core/components/CoreLayout.tsx index fabbd121..aedf24b4 100644 --- a/src/layouts/core/components/CoreLayout.tsx +++ b/src/layouts/core/components/CoreLayout.tsx @@ -161,7 +161,8 @@ const CoreLayout: React.FunctionComponent = (props): JSX.Element => { }, })} > -
= (props): JSX.Element => {
) } -
+ ); }; diff --git a/src/layouts/demo/components/DemoFooter.tsx b/src/layouts/demo/components/DemoFooter.tsx index d677815b..5a586573 100644 --- a/src/layouts/demo/components/DemoFooter.tsx +++ b/src/layouts/demo/components/DemoFooter.tsx @@ -51,8 +51,9 @@ const DemoFooter: React.FunctionComponent = (props) => { const currentYear = (new Date()).getFullYear(); return ( - - + ); }; diff --git a/src/layouts/demo/components/DemoLayout.tsx b/src/layouts/demo/components/DemoLayout.tsx index 8668c500..3d7d02a6 100644 --- a/src/layouts/demo/components/DemoLayout.tsx +++ b/src/layouts/demo/components/DemoLayout.tsx @@ -80,61 +80,66 @@ const DemoLayout: React.FunctionComponent = (props): JSX.Element => { }, })} > - - - - {/* Loaded from components/Head - See https://github.com/mikemaccana/outdated-browser-rework */} - {/**/} +
+ + - { - // XXX You may want to enable preview mode during non-production stages only - process.env.NEXT_PUBLIC_APP_STAGE !== 'production' && ( - - ) - } + {/* Loaded from components/Head - See https://github.com/mikemaccana/outdated-browser-rework */} + {/**/} - { - (!isInIframe || isIframeWithFullPagePreview) && ( - - ) - } + { + // XXX You may want to enable preview mode during non-production stages only + process.env.NEXT_PUBLIC_APP_STAGE !== 'production' && ( + + ) + } -
{ - // If an error happened, we display it instead of displaying the page - // We display a custom error instead of the native Next.js error by providing children (removing children will display the native Next.js error) - error ? ( - - - - ) : ( - - {children} - + (!isInIframe || isIframeWithFullPagePreview) && ( + ) } -
- { - (!isInIframe || isIframeWithFullPagePreview) && ( - - ) - } +
+ { + // If an error happened, we display it instead of displaying the page + // We display a custom error instead of the native Next.js error by providing children (removing children will display the native Next.js error) + error ? ( + + + + ) : ( + + {children} + + ) + } +
+ + { + (!isInIframe || isIframeWithFullPagePreview) && ( + + ) + } +
); }; diff --git a/src/layouts/demo/components/DemoNav.tsx b/src/layouts/demo/components/DemoNav.tsx index 315e4850..88b8b0e2 100644 --- a/src/layouts/demo/components/DemoNav.tsx +++ b/src/layouts/demo/components/DemoNav.tsx @@ -66,6 +66,7 @@ const DemoNav: React.FunctionComponent = () => { {({ logEvent }: { logEvent: LogEvent }): JSX.Element => ( = (props): JSX.Element const shouldDisplayI18nButton = availableLanguages?.length > 1; return ( -
+
= (props): JSX.Element }
- + ); }; diff --git a/src/modules/core/previewMode/components/PreviewModeBanner.tsx b/src/modules/core/previewMode/components/PreviewModeBanner.tsx index e4847d96..a0cb6ff0 100644 --- a/src/modules/core/previewMode/components/PreviewModeBanner.tsx +++ b/src/modules/core/previewMode/components/PreviewModeBanner.tsx @@ -69,7 +69,8 @@ const PreviewModeBanner: React.FunctionComponent = (props): JSX.Element = } return ( -
= (props): JSX.Element = ) } -
+ ); };