From 1b9bef7295dabe51012cfcc5bd0aac7400f2eea7 Mon Sep 17 00:00:00 2001 From: Xavier Rutayisire Date: Wed, 27 Dec 2023 22:32:14 +0100 Subject: [PATCH] fix(accessibility): Update editor packages & use hiddenLabel for Icon Button (#1257) --- .../components/AppLayout/index.tsx | 2 +- .../CustomTypeBuilder/SliceZone/index.tsx | 2 +- .../builders/SliceBuilder/Sidebar/index.tsx | 2 +- .../SliceBuilder/SimulatorButton/index.tsx | 2 +- .../Zone/components/EmptyState/index.tsx | 2 +- .../lib/builders/common/Zone/index.jsx | 2 +- packages/slice-machine/package.json | 6 +-- .../components/BlankSlate/BlankSlate.css.ts | 5 ++- .../src/components/BlankSlate/BlankSlate.tsx | 9 +--- .../src/components/Card/Card.stories.tsx | 6 +-- .../src/components/HoverCard/HoverCard.css.ts | 9 ---- .../HoverCard/HoverCard.stories.tsx | 2 +- .../src/components/HoverCard/HoverCard.tsx | 2 +- .../src/components/List/List.stories.tsx | 4 +- .../SideNav/SideNavEnvironmentSelector.tsx | 4 +- .../src/components/Window/Window.tsx | 2 +- .../src/features/customTypes/EditDropdown.tsx | 12 +++--- .../PageSnippetDialog/PageSnippetDialog.tsx | 4 +- .../features/inAppGuide/InAppGuideDialog.tsx | 8 +--- .../ConvertLegacySliceAsNewSliceDialog.tsx | 2 +- ...ConvertLegacySliceAsNewVariationDialog.tsx | 2 +- .../ConvertLegacySliceButton.tsx | 2 +- ...ertLegacySliceMergeWithIdenticalDialog.tsx | 2 +- .../sliceBuilder/FloatingBackButton.tsx | 2 +- .../slices/sliceCards/SharedSliceCard.tsx | 4 +- playwright/pages/SliceBuilderPage.ts | 2 +- playwright/pages/SlicesListPage.ts | 4 +- .../pages/components/EnvironmentSelector.ts | 12 ++++-- playwright/pages/shared/TypeBuilderPage.ts | 6 ++- playwright/pages/shared/TypesTablePage.ts | 4 +- yarn.lock | 41 +++++++++++-------- 31 files changed, 84 insertions(+), 84 deletions(-) diff --git a/packages/slice-machine/components/AppLayout/index.tsx b/packages/slice-machine/components/AppLayout/index.tsx index 5b5eb3c0ee..ba131d5759 100644 --- a/packages/slice-machine/components/AppLayout/index.tsx +++ b/packages/slice-machine/components/AppLayout/index.tsx @@ -83,7 +83,7 @@ export const AppLayoutBackButton: FC = ({ void router.push(url); }} startIcon="arrowBack" - variant="secondary" + color="grey" /> ); }; diff --git a/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/index.tsx b/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/index.tsx index 739add02ee..fbd6c1eea3 100644 --- a/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +++ b/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/index.tsx @@ -213,7 +213,7 @@ const SliceZone: React.FC = ({ sliceZone ? ( - diff --git a/packages/slice-machine/lib/builders/SliceBuilder/Sidebar/index.tsx b/packages/slice-machine/lib/builders/SliceBuilder/Sidebar/index.tsx index b57ce844e5..a35fc927e6 100644 --- a/packages/slice-machine/lib/builders/SliceBuilder/Sidebar/index.tsx +++ b/packages/slice-machine/lib/builders/SliceBuilder/Sidebar/index.tsx @@ -94,7 +94,7 @@ export const Sidebar: FC = (props) => { // Set `position` to `relative` to position `Button` on top of // `Gradient`. sx={{ position: "relative" }} - variant="secondary" + color="grey" > Add a new variation diff --git a/packages/slice-machine/lib/builders/SliceBuilder/SimulatorButton/index.tsx b/packages/slice-machine/lib/builders/SliceBuilder/SimulatorButton/index.tsx index e1751dade2..679d003a94 100644 --- a/packages/slice-machine/lib/builders/SliceBuilder/SimulatorButton/index.tsx +++ b/packages/slice-machine/lib/builders/SliceBuilder/SimulatorButton/index.tsx @@ -155,7 +155,7 @@ const SimulatorButton: React.FC<{ width={tokens.size[24]} /> )} - variant="secondary" + color="grey" > Simulate diff --git a/packages/slice-machine/lib/builders/common/Zone/components/EmptyState/index.tsx b/packages/slice-machine/lib/builders/common/Zone/components/EmptyState/index.tsx index 62e4cbd513..351106602a 100644 --- a/packages/slice-machine/lib/builders/common/Zone/components/EmptyState/index.tsx +++ b/packages/slice-machine/lib/builders/common/Zone/components/EmptyState/index.tsx @@ -18,7 +18,7 @@ const ZoneEmptyState = ({ diff --git a/packages/slice-machine/package.json b/packages/slice-machine/package.json index b226c3ba3f..fd44551b30 100644 --- a/packages/slice-machine/package.json +++ b/packages/slice-machine/package.json @@ -38,9 +38,9 @@ "devDependencies": { "@emotion/react": "11.11.1", "@extractus/oembed-extractor": "3.1.8", - "@prismicio/editor-fields": "0.4.17", - "@prismicio/editor-support": "0.4.17", - "@prismicio/editor-ui": "0.4.17", + "@prismicio/editor-fields": "0.4.18", + "@prismicio/editor-support": "0.4.18", + "@prismicio/editor-ui": "0.4.18", "@prismicio/mocks": "2.0.0-alpha.2", "@prismicio/simulator": "0.1.4", "@prismicio/types-internal": "2.2.0", diff --git a/packages/slice-machine/src/components/BlankSlate/BlankSlate.css.ts b/packages/slice-machine/src/components/BlankSlate/BlankSlate.css.ts index e4e895917e..0401d959d0 100644 --- a/packages/slice-machine/src/components/BlankSlate/BlankSlate.css.ts +++ b/packages/slice-machine/src/components/BlankSlate/BlankSlate.css.ts @@ -79,8 +79,11 @@ export const desc = style({ export const actions = style([ sprinkles({ - gap: 16, + all: "unset", alignItems: "center", + boxSizing: "border-box", + display: "flex", + gap: 16, marginTop: 16, }), { diff --git a/packages/slice-machine/src/components/BlankSlate/BlankSlate.tsx b/packages/slice-machine/src/components/BlankSlate/BlankSlate.tsx index b4c375808c..500e762240 100644 --- a/packages/slice-machine/src/components/BlankSlate/BlankSlate.tsx +++ b/packages/slice-machine/src/components/BlankSlate/BlankSlate.tsx @@ -1,5 +1,5 @@ import clsx from "clsx"; -import { ButtonGroup, Text } from "@prismicio/editor-ui"; +import { Text } from "@prismicio/editor-ui"; import type { CSSProperties, FC, PropsWithChildren } from "react"; import * as styles from "./BlankSlate.css"; @@ -46,10 +46,5 @@ export const BlankSlateDescription: FC = (props) => ( ); export const BlankSlateActions: FC = (props) => ( - +
); diff --git a/packages/slice-machine/src/components/Card/Card.stories.tsx b/packages/slice-machine/src/components/Card/Card.stories.tsx index fc374c6b38..2ee0f72d7f 100644 --- a/packages/slice-machine/src/components/Card/Card.stories.tsx +++ b/packages/slice-machine/src/components/Card/Card.stories.tsx @@ -41,7 +41,7 @@ export const Default = { } /> Action} + action={} subtitle="Subtitle" title="Title" /> @@ -66,7 +66,7 @@ export const SolidWithImg = { renderStartIcon={() => ( )} - variant="secondary" + color="grey" > Update screenshot @@ -109,7 +109,7 @@ export const SolidWithDiv = { renderStartIcon={() => ( )} - variant="secondary" + color="grey" > Turn into shared Slice diff --git a/packages/slice-machine/src/components/HoverCard/HoverCard.css.ts b/packages/slice-machine/src/components/HoverCard/HoverCard.css.ts index 7b82c35fc3..15200c628d 100644 --- a/packages/slice-machine/src/components/HoverCard/HoverCard.css.ts +++ b/packages/slice-machine/src/components/HoverCard/HoverCard.css.ts @@ -103,12 +103,3 @@ export const closeButtonContainer = style([ paddingInline: 16, }), ]); - -export const closeButton = style([ - blockWithDisplayRevert, - sprinkles({ - boxShadow: 1, - textAlign: "center", - width: "100%", - }), -]); diff --git a/packages/slice-machine/src/components/HoverCard/HoverCard.stories.tsx b/packages/slice-machine/src/components/HoverCard/HoverCard.stories.tsx index 8d3d4ab4ad..71c40157ed 100644 --- a/packages/slice-machine/src/components/HoverCard/HoverCard.stories.tsx +++ b/packages/slice-machine/src/components/HoverCard/HoverCard.stories.tsx @@ -32,7 +32,7 @@ export const Image = { children: ( <> Prismic Academy© - + Lorem ipsum dolor sit amet consectetur. Aenean purus aliquam vel eget vitae etiam diff --git a/packages/slice-machine/src/components/HoverCard/HoverCard.tsx b/packages/slice-machine/src/components/HoverCard/HoverCard.tsx index 5ccb7e6895..84906ae58f 100644 --- a/packages/slice-machine/src/components/HoverCard/HoverCard.tsx +++ b/packages/slice-machine/src/components/HoverCard/HoverCard.tsx @@ -161,7 +161,7 @@ export const HoverCardCloseButton: FC = ({ children }) => { return (
-
diff --git a/packages/slice-machine/src/components/List/List.stories.tsx b/packages/slice-machine/src/components/List/List.stories.tsx index fb9f1147bb..8b598d3bae 100644 --- a/packages/slice-machine/src/components/List/List.stories.tsx +++ b/packages/slice-machine/src/components/List/List.stories.tsx @@ -23,7 +23,7 @@ export const Default = { Show code snippets? - @@ -35,7 +35,7 @@ export const Default = { + } diff --git a/packages/slice-machine/src/components/SideNav/SideNavEnvironmentSelector.tsx b/packages/slice-machine/src/components/SideNav/SideNavEnvironmentSelector.tsx index 5729b09ad5..72c4f42579 100644 --- a/packages/slice-machine/src/components/SideNav/SideNavEnvironmentSelector.tsx +++ b/packages/slice-machine/src/components/SideNav/SideNavEnvironmentSelector.tsx @@ -87,7 +87,7 @@ export const SideNavEnvironmentSelector: FC = ( } onClick={onLogInClick} - data-cy="environment-login-icon-button" + hiddenLabel="Log in to enable environments" /> ) : undefined} @@ -114,7 +114,7 @@ const EnvironmentDropdownMenu: FC = (props) => { return ( - + {/* diff --git a/packages/slice-machine/src/components/Window/Window.tsx b/packages/slice-machine/src/components/Window/Window.tsx index bb41819dd9..3633859955 100644 --- a/packages/slice-machine/src/components/Window/Window.tsx +++ b/packages/slice-machine/src/components/Window/Window.tsx @@ -46,7 +46,7 @@ export const WindowTabsList: FC = ({ {children}
- +
); diff --git a/packages/slice-machine/src/features/customTypes/EditDropdown.tsx b/packages/slice-machine/src/features/customTypes/EditDropdown.tsx index 28a9fffdfe..fb45745bc3 100644 --- a/packages/slice-machine/src/features/customTypes/EditDropdown.tsx +++ b/packages/slice-machine/src/features/customTypes/EditDropdown.tsx @@ -5,7 +5,7 @@ import { DropdownMenuItem, DropdownMenuTrigger, Icon, - Button, + IconButton, } from "@prismicio/editor-ui"; import { useRouter } from "next/router"; @@ -72,11 +72,13 @@ export const EditDropdown: FC = ({ <> - } @@ -75,7 +75,7 @@ export const PageSnippetDialog: FC = ({ model }) => { + } diff --git a/packages/slice-machine/src/features/inAppGuide/InAppGuideDialog.tsx b/packages/slice-machine/src/features/inAppGuide/InAppGuideDialog.tsx index 4d1997952a..da4552047b 100644 --- a/packages/slice-machine/src/features/inAppGuide/InAppGuideDialog.tsx +++ b/packages/slice-machine/src/features/inAppGuide/InAppGuideDialog.tsx @@ -72,13 +72,7 @@ export const InAppGuideDialog: FC = () => { {content.title} -